Skip to the page
Year 10 · ICT · Summer 2 · Website authoring and images; the Year 10 mock

A full past-paper website task

Exam practicePresent ▶

What this lesson covers

21.2b HTML body: text, tables and media

Cambridge IGCSE ICT 0417 · Topic 21: Website authoring · Paper 3

21.2c Hyperlinks and file paths

Cambridge IGCSE ICT 0417 · Topic 21: Website authoring · Paper 3

21.3b CSS: page styles, tables and the cascade

Cambridge IGCSE ICT 0417 · Topic 21: Website authoring · Paper 3

You will learn to

  • Complete a full past-paper website task under timed conditions.
  • Give clear evidence: screenshots of the HTML and CSS source, and of the page in a browser.
  • Evaluate your work against the mark scheme, including the evidence document.

Success criteria

  • I can finish the task in the time set.
  • I can test every link and every image before I save.
  • I can mark my evidence document and say which marks were lost, and why.
The syllabus points for these sections
  • Mark up headings, paragraphs and ordered and unordered lists.
  • Group content with div elements and classes.
  • Build tables with th, td, rowspan and colspan, and set sizes in pixels or %.
  • Insert images, sound and video with alt text, sizes and controls.
  • Create bookmarks with id and link to them on the same page or another page.
  • Link to local pages, external URLs and email addresses.
  • Open links in a new window or a named window.
  • Explain relative and absolute paths, and why absolute paths to local files must not be used.
  • Style h1, h2, h3, p and li in one external stylesheet.
  • Style tables and cells: borders, collapse, padding, spacing, size, colour and alignment.
  • Apply the cascading order to predict which style wins.
  • Give clear evidence and avoid the common ways website marks are lost.

Key words

Say each word, then read what it means. Every one is in the glossary too.

HTML
HyperText Markup Language: the language of the content layer of a web page.
CSS
Cascading Style Sheets: the language of the presentation layer, which sets how a page looks.
Tag
A word in angle brackets, such as `<p>`, that marks the start or end of an element.
Attribute
Extra information inside an opening tag, written name="value", such as src or alt.
Head
The part of a page holding information about it: title, meta tags, stylesheet links.
External stylesheet
A separate .css file attached to pages with the link element.
Inline style
CSS written in a style attribute inside one tag; it affects only that element.
Class
A label given to elements with the class attribute so CSS can style them as a group.
Selector
The part of a CSS rule that says which elements it styles, such as h1 or .note.
Generic font family
A fallback type of font (serif, sans-serif, monospace) used if named fonts are missing.
Cascade
The rules that decide which style wins when two styles set the same property.
Bookmark
A named place on a page, made with an id, that a hyperlink can jump to.
Hyperlink
Clickable text or an image that goes to another place, made with the a tag.
Relative path
A file location described from the current file's folder, such as images/logo.png.
Absolute path
A full file location from the very start, such as a full URL or C:/...
Target
The attribute that sets which window a link opens in, such as _blank.
colspan / rowspan
Attributes that make a table cell stretch across columns or down rows.
Padding
The space inside an element or cell between its border and its content.
Alt text
Alternative text for an image, read by screen readers and shown if the image fails.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

Run it like the real exam

Use the same time rule as the spreadsheet task: about 2 minutes per mark.

  1. Copy the source files into the folder the task names. Work only on the copies.
  2. Edit the HTML and CSS in a text editor. View the page in a browser.
  3. Save each file with the exact name the task gives.
  4. Put your name, centre number and candidate number on the evidence document.
!Watch out

Use relative paths only. A path like C:\Users\… works on your computer but breaks everywhere else.

The evidence document

The examiner never opens your web page. They only mark the screenshots in your evidence document.

EvidenceWhat it must show
HTML sourceEvery line the task asks about, readable. Zoom in or take two screenshots.
CSS sourceThe whole stylesheet, including the selectors.
Page in a browserThe finished page, so the examiner sees the styles working.
★Remember

If a line of code is cut off or blurred in the screenshot, it cannot earn a mark.

Check before you stop

  • Click every link. Does each one open the right page, window or email?
  • Does every image show? Check the file name, including capital letters.
  • Is the stylesheet attached? Rename it for a moment: the page should lose its styles.
  • Search the code for C:\ or file:// and replace them with relative paths.

Then mark it against the scheme. Add each lost mark to the same log as the spreadsheet task.

21.2b HTML body: text, tables and media

Headings and paragraphs

`<h1>` is the main heading. `<h2>` is a subheading. `<h3>` is a heading inside an h2 section.

`<p>` is a paragraph. The browser adds space before and after it.

Use headings in order. Choose the tag for what the text is, not for how big it looks. CSS controls the size.

<h1>Café Retiro</h1>
<h2>Breakfast</h2>
<h3>Served until 12:00</h3>
<p>Fresh coffee, toast with tomato and olive oil, and homemade cakes.</p>
?Why?

Search engines and screen readers use headings to understand the page. A blind visitor can jump from heading to heading.

Ordered and unordered lists

An unordered list `<ul>` shows bullet points. Use it when order does not matter.

An ordered list `<ol>` shows numbers. Use it when order matters, such as steps or a top 3.

Each item goes in `<li>` (list item), inside the ul or ol.

<ul>
    <li>Café con leche</li>
    <li>Tostada con tomate</li>
    <li>Tarta de Santiago</li>
</ul>

<ol>
    <li>Choose a cake.</li>
    <li>Pay at the counter.</li>
    <li>Collect your order.</li>
</ol>
!Watch out

An li must be inside a ul or ol. A list item on its own is invalid HTML.

div and classes

A `<div>` is a box that groups other elements. On its own it changes nothing you can see.

A class is a label you give to elements with the class attribute. CSS can then style everything with that label.

Many elements can share one class. One element can have two classes, separated by a space.

<div class="offer">
    <h2>Today's offer</h2>
    <p>Coffee and a croissant for €3.20.</p>
    <p class="note">Until 11:00 only.</p>
</div>
/* every element with class="offer" */
.offer {
    background-color: #FFF3E0;
    border: 2px dashed #8B4513;
    padding: 10px;
}

.note {
    font-style: italic;
}
?Why?

A class lets you style some paragraphs differently without changing every paragraph.

Tables: table, tr, th, td

`<table>` starts a table. Each row is a `<tr>` (table row).

Inside a row, each cell is a `<td>` (table data) or a `<th>` (table header). Header cells are bold and centred by default.

Build a table row by row, from top to bottom. In each row, write the cells from left to right.

<table>
    <tr>
        <th>Drink</th>
        <th>Price</th>
    </tr>
    <tr>
        <td>Café con leche</td>
        <td>€1.80</td>
    </tr>
    <tr>
        <td>Té verde</td>
        <td>€1.60</td>
    </tr>
</table>
!Watch out

Every row must be closed with `</tr>` before the next `<tr>`. A missing closing tag can shift cells into the wrong row.

Merging cells: colspan and rowspan

colspan makes a cell stretch across several columns. colspan="3" fills 3 columns.

rowspan makes a cell stretch down several rows. rowspan="2" fills 2 rows.

When a cell spans, leave out the cells it covers. A row below a rowspan cell has one cell fewer.

DayOpenClose
Monday to Friday07:3020:00
Saturday09:00 (rowspan="2" covers Saturday and Sunday)21:00
Sunday(covered by the cell above)15:00
e.g.Example
Check by counting columns in each row: Row 1: one th with colspan 3 → 3 columns Row 2: 3 th → 3 Row 3: 3 td → 3 Row 4: Saturday + 09:00 (rowspan 2) + 21:00 → 3 Row 5: Sunday + (09:00 from above) + 15:00 → 3. Only 2 td are written.
<h2 id="hours">Opening hours</h2>
<table>
    <tr>
        <th colspan="3">Opening hours</th>
    </tr>
    <tr>
        <th>Day</th>
        <th>Open</th>
        <th>Close</th>
    </tr>
    <tr>
        <td>Monday to Friday</td>
        <td>07:30</td>
        <td>20:00</td>
    </tr>
    <tr>
        <td>Saturday</td>
        <td rowspan="2">09:00</td>
        <td>21:00</td>
    </tr>
    <tr>
        <td>Sunday</td>
        <td>15:00</td>
    </tr>
</table>
!Watch out

If row 5 also had a cell for 09:00, the row would have 4 columns and the table would stick out on the right.

Table and cell sizes

Set a width or height in pixels (px) for a fixed size, or in percent (%) for a share of the space.

width: 80% on a table makes it 80% of the page width, so it shrinks on a phone. 600px stays the same on every screen.

Use a style attribute in the tag, or a rule in the stylesheet. Older pages use width="80%" attributes. You may see them in source files.

<table style="width:80%">
    <tr>
        <th style="width:200px">Day</th>
        <td style="height:40px">Monday to Friday</td>
    </tr>
</table>
/* the same sizes, set in the stylesheet */
table {
    width: 80%;
}
th {
    width: 200px;
}
td {
    height: 40px;
}
!Watch out

Write the unit with no space: 200px, not 200 px or 200. Without a valid unit, the browser ignores the size.

Images

`<img>` inserts an image. It has no closing tag.

src is the relative path to the image file. alt is the alternative text, read aloud by screen readers and shown if the image cannot load.

width and height set the display size in pixels. Keep the aspect ratio (topic 12), or the image looks stretched.

e.g.Example
tarta.jpg is 600 × 400 pixels. The ratio is 600 ÷ 400 = 1.5. The question asks for a width of 300 pixels. Height = 300 ÷ 1.5 = 200 pixels. The ratio is kept. width="300" height="300" would squash the cake into a square.
<img src="images/tarta.jpg" alt="A slice of tarta de Santiago, an almond cake" width="300" height="200">
?Why?

Alt text makes the page accessible to blind visitors. The exam often asks for it and gives the exact words.

Sound and video

`<audio>` plays sound and `<video>` plays video. Put the file in a `<source>` tag inside them, with its type.

controls shows play, pause and volume buttons. autoplay starts the media when the page loads.

Video takes width and height in pixels. Text inside the element shows only if the browser cannot play the file.

<audio controls>
    <source src="media/jingle.mp3" type="audio/mpeg">
    Your browser cannot play this sound.
</audio>

<video width="480" height="270" controls autoplay muted>
    <source src="media/barista.mp4" type="video/mp4">
    Your browser cannot play this video.
</video>
?Why?

controls, autoplay and muted are true or false attributes. Writing the word switches them on. They need no value.

!Watch out

Most browsers block autoplay with sound. Add muted so autoplay works. Without controls, a visitor cannot pause the media.

21.2c Hyperlinks and file paths

Bookmarks and links to them

A bookmark is a named place on a page. Give any element an id: `<h2 id="hours">`.

A hyperlink uses the `<a>` (anchor) tag. Its href is where it goes. The text between the tags is what you click.

To jump to a bookmark, href is # then the id. To jump to a bookmark on another page, add the page name first.

<h1 id="top">Café Retiro</h1>
<a href="#hours">See our opening hours</a>

<h2 id="hours">Opening hours</h2>
<a href="#top">Back to top</a>

<!-- a bookmark called drinks on another page -->
<a href="menu.html#drinks">Drinks menu</a>
!Watch out

An id must be unique on the page and contain no spaces. It is case-sensitive: href="#Hours" will not find id="hours". Old pages use `<a name="hours">` instead of id.

Links to pages, websites and email

A local page is a page in your own site. Link to it with a relative path, such as menu.html.

An external website needs its full URL, starting with https://.

An email link uses mailto: then the address. Clicking it opens a new email to that address. You can add a subject with ?subject=.

<a href="menu.html">Our menu</a>

<a href="https://www.esmadrid.com">Visit Madrid</a>

<a href="mailto:orders@example.com">Email us</a>

<a href="mailto:orders@example.com?subject=Order">Order a cake</a>
!Watch out

href="www.esmadrid.com" without https:// does not go to the website. The browser looks for a file called www.esmadrid.com in your own folder.

Target windows: _blank, _self and named windows

The target attribute says where a link opens.

_blank opens a new window or tab. _self opens in the same window, which is the default.

A named window is any name you choose, such as target="menuwin". The first click opens a window with that name. Later links with the same target reuse it.

A target on a link overrides the base target in the head.

<a href="https://www.esmadrid.com" target="_blank">Visit Madrid</a>

<a href="menu.html" target="menuwin">Food menu</a>
<a href="drinks.html" target="menuwin">Drinks menu</a>
<!-- both open in the same window, called menuwin -->
?Why?

Opening external sites in a new window keeps your page open, so the visitor can come back to it.

!Watch out

_blank needs the underscore. target="blank" (no underscore) is treated as a named window called blank.

Relative and absolute paths

A path tells the browser where a file is.

A relative path starts from the folder of the current file. images/logo.png means "go into the images folder, then find logo.png".

../ means "go up one folder". From styles/cafe.css, the path to the beans image is ../images/beans.jpg.

An absolute path gives the full location from the very start, such as https://www.esmadrid.com/en or C:/Users/Lucia/Desktop/cafe/images/logo.png.

Try the toy: press From on one file and To on another, and read the relative path and why the absolute path breaks. Then switch to Quiz and write paths yourself. The toy's site uses css/style.css, but the rules are the same.

FromToRelative path
index.htmlmenu.htmlmenu.html
index.htmlimages/logo.pngimages/logo.png
index.htmlstyles/cafe.cssstyles/cafe.css
styles/cafe.cssimages/beans.jpg../images/beans.jpg
pages/about.htmlindex.html../index.html
!Watch out

Use forward slashes / in paths, not backslashes \. Match capitals exactly: on a web server Logo.PNG and logo.png are different files.

There is something to try for this step in the IGCSE library.

Why absolute paths to local files break

An absolute local path points to one place on one computer. C:/Users/Lucia/Desktop/... exists only on Lucía's computer.

When the folder is copied to a web server or an examiner's computer, that path no longer exists. Images vanish and the stylesheet is not applied.

Relative paths move with the folder, because they only describe how files sit compared with each other.

Absolute URLs are fine for external websites, because those addresses are the same from every computer.

e.g.Example
Lucía's page has `<img src="file:///C:/Users/Lucia/Desktop/cafe/images/logo.png">`. On her laptop: the logo shows. On the examiner's computer: there is no user called Lucia, so the logo is missing. With `<img src="images/logo.png">`: the logo shows on both.
!Watch out

Some editors insert absolute paths when you drag a file in. Always read the code and change it to a relative path.

21.3b CSS: page styles, tables and the cascade

A full stylesheet for h1, h2, h3, p and li

Exam tasks often give a list of styles to set for each element. Write one rule per selector, in the same order as the list.

Repeat a property in each rule where the task asks for it, even if it looks the same as another rule.

Try the toy: paste this CSS into the CSS box. In the HTML box, replace everything between `<body>` and `</body>` with this HTML, so the stylesheet link stays. Change the h2 colour or the p font size and watch the preview update.

/* Café Retiro house style */
body {
    background-color: #FDF6EC;
}

h1 {
    font-family: "Trebuchet MS", Helvetica, sans-serif;
    font-size: 32px;
    color: #8B4513;
    text-align: center;
}

h2 {
    font-family: "Trebuchet MS", Helvetica, sans-serif;
    font-size: 24px;
    color: #2E7D32;
}

h3 {
    font-family: "Trebuchet MS", Helvetica, sans-serif;
    font-size: 18px;
    color: #2E7D32;
    font-style: italic;
}

p {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    color: #333333;
    text-align: justify;
}

li {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    font-weight: bold;
}
<h1>Café Retiro</h1>
<h2>Breakfast</h2>
<h3>Served until 12:00</h3>
<p>Fresh coffee, toast with tomato and olive oil, and homemade cakes.</p>
<ul>
    <li>Café con leche</li>
    <li>Tostada con tomate</li>
    <li>Tarta de Santiago</li>
</ul>
?Why?

The li rule makes the three menu items bold. Their font, size and colour come from the li rule too, so lists match the paragraphs.

There is something to try for this step in the IGCSE library.

Table borders: thickness, colour, collapse, invisible

border sets thickness, style and colour in one line: `border: 2px solid #8B4513;`. The style must be given, such as solid, dashed or dotted.

A border on table styles only the outside edge. Borders between cells need a rule for th and td too.

border-collapse: collapse merges the double lines between cells into single lines.

To make borders invisible, use border: none (or border-style: hidden). To make them visible, give a style such as solid.

table {
    border: 3px solid #8B4513;
    border-collapse: collapse;
}

th, td {
    border: 1px solid #8B4513;
}

/* a layout table with no visible borders */
table.plain, table.plain td {
    border: none;
}
!Watch out

border: 2px #8B4513; with no style shows no border at all. The default style is none.

Cells: padding, spacing, size, colour and alignment

padding is the space inside a cell, between its border and its content.

border-spacing is the gap between cells. It works only when border-collapse is separate, which is the default.

text-align sets horizontal alignment (left, center, right). vertical-align sets vertical alignment (top, middle, bottom).

Cells take width, height and background-color like any other element.

table {
    width: 80%;
    border-collapse: separate;
    border-spacing: 4px;
}

th {
    background-color: #8B4513;
    color: #FFFFFF;
    padding: 8px;
}

td {
    height: 40px;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
    background-color: #FFF3E0;
}
?Why?

Padding stops text touching the border, so the table is easier to read. Spacing separates cells into boxes.

The cascade: which style wins

When two rules set the same property on the same element, the browser uses the cascade to choose.

Highest priority first: inline style, then internal stylesheet, then external stylesheet, then the browser's own defaults.

Internal beats external when the `<style>` element comes after the `<link>`, which is the normal order. In fact, the rule read last wins.

Inside one stylesheet, a later rule beats an earlier rule for the same selector. A class selector beats a plain element selector, whatever the order.

e.g.Example
Breakfast: the external rule says green, the internal rule says blue. Internal wins → blue. Lunch: the inline style says red. Inline wins → red. Both headings are still 24px, because only the external rule sets font-size. The cascade decides each property separately.
<link rel="stylesheet" href="styles/cafe.css">  <!-- h2 green -->
<style>
    h2 { color: #1565C0; }                      /* h2 blue */
</style>
...
<h2>Breakfast</h2>
<h2 style="color: #C62828;">Lunch</h2>        <!-- inline red -->
/* styles/cafe.css */
h2 {
    color: #2E7D32;
    font-size: 24px;
}

How website marks are lost

Most lost marks come from small typing errors that a browser ignores without warning.

Before taking screenshots, open the page in a browser and check every style and link really works.

MistakeHow to avoid it
Absolute path to a local file (C:/... or file:///...)use relative paths such as styles/cafe.css
colour or centre in CSSuse color and center
Missing ; or }, so later styles failend every declaration with ; and close every rule
Quotes round a generic familyfont-family: Arial, sans-serif;
Size with no unit or a space (16 or 16 px)16px
`<style>` tags inside the .css filethe .css file holds CSS only
File saved as cafe.css.txt or with wrong capitalssave as the exact name and type given
Missing alt text, or tags not closedcheck each tag has its partner
URL without https://write the full URL

Giving evidence

Take a screenshot of the HTML source in the text editor, with every line readable. Use more than one screenshot if the code is long.

Take a screenshot of the page in a browser, showing the result of the styles.

Take a screenshot of the CSS file in the editor, showing its file name if possible.

Paste them into the evidence document in the order the question asks, and label each one.

?Why?

The source proves which tags, attributes and paths you used. The browser view proves they work. Examiners often need both to award a mark.

!Watch out

A screenshot of a page that looks right earns nothing if the code that made it is cut off. Zoom so the code is readable but nothing is hidden.

Study it

Open the study page and go one step at a time.

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.