Website Authoring
Section: Applications | Syllabus: Cambridge IGCSE Information and Communication Technology (0417)
Web Development Layers
A web page is built from three separate layers, each with its own job:
| Layer | Purpose |
|---|---|
| Content layer | Used to enter the content and create the structure of a web page (HTML) |
| Presentation layer | Used to display and format elements within a web page (CSS) |
| Behaviour layer | A scripting language used to control elements within a web page (e.g. responding to a button click) |
Create a Web Page (HTML — The Content Layer)
- Place appropriate elements in the head section: a page title to display in the browser; external stylesheets attached with the correct hierarchy, using a relative file path; metatags (charset, name attributes such as description/keywords/author/viewport, content attributes); default target windows
- Place appropriate content in the body section: insert a table (table header, table rows, table data); use appropriate table attributes to span cells over more than one row/column, set sizes in pixels or % values, and apply styles to tables
- Insert appropriate objects into a web page: text, images, sound clips, video (display controls, remove controls, autoplay); adjust image/video size and aspect ratio, and apply alternate text
- Use the tag to apply styles and classes to a block of content
- Apply tags that display pre-defined styles: h1, h2, h3, p, li; apply classes to elements
- Apply styles to a list (ordered list, unordered list)
- Create a bookmark within a web page using an id attribute
- Create hyperlinks from text and images to: a bookmark on the same page; another locally stored web page; a website using its URL; an email address; and set where the link opens (same window, a new window, a named window)
- An anchor is the element used to create a hyperlink
- Relative file paths (not absolute) must be used for hyperlinks to locally stored web pages/objects, so the links still work if the whole site is moved to a different folder or server
Purpose of Key Metatags
| Metatag Purpose | What It Defines |
|---|---|
| Charset | The character encoding used by the page, e.g. UTF-8 |
| Keywords | Words to help search engines find the page |
| Author | Who wrote the web page |
| Description | A short summary of the web page |
| Viewport | Makes the web page display correctly on different devices/screen sizes |
Use Stylesheets (CSS — The Presentation Layer)
- Create generic external styles and inline style attributes: background properties (colour, images), font properties, table/table row/table header/table data properties (size, background colour, horizontal/vertical alignment, spacing, padding, borders — including collapsed, colour, thickness, visible/invisible)
- Create classes covering the same kinds of properties, to apply the same formatting to a chosen set of elements
- Create external styles tagged in a web page: h1, h2, h3, p, li; specify font properties: font family, size, colour, alignment, bold, italic
- Attach comments to an external stylesheet, and save styles in cascading stylesheet format
- Characteristics of cascading stylesheets: the difference between attached stylesheets and inline style attributes, and the hierarchy of multiple attached stylesheets and inline styles within one web page
- Generally, an inline style overrides an attached stylesheet, and a stylesheet attached later in the head section takes priority over one attached earlier, for any property they both set
- Characteristics of a style versus a class: a tag-based style (e.g. on every h1) applies automatically to every element of that tag; a class must be deliberately applied to specific elements, and several different tags can share the same class
- Relative file paths must be used for attached stylesheets, for the same reason as hyperlinks — so the link between the page and its stylesheet keeps working if the site is moved
Question: A website's style specification states that all heading level 1 (h1) text must be: colour hex code CC0000, font Arial (or the browser's default sans-serif font if Arial is unavailable), 32 points high, and centre-aligned. Write the CSS rule needed to implement this specification.
Each requirement in the plain-English specification maps onto one CSS property: colour needs the "color" property, font needs a "font-family" list with a fallback, size needs "font-size", and alignment needs "text-align". The specification explicitly gives a fallback font, so the font-family list must include both Arial and a generic sans-serif option, in that order. Answerh1 color: #CC0000; font-family: Arial, sans-serif; font-size: 32pt; text-align: center;
Common Mistakes
MistakeUsing an absolute file path (e.g. a full local folder path or drive letter) to attach a stylesheet or link to another local page
Fixan absolute path only works on the exact computer/location it was written on; a relative path (e.g. "styles/main.css") keeps working wherever the whole site folder is moved to
MistakeForgetting that an inline style or a later-attached stylesheet can silently override an earlier CSS rule
Fixwhen a page doesn't look as expected, check the stylesheet hierarchy — an inline style attribute, or a second stylesheet attached after the first, takes priority over an earlier rule for any property they both set
Interactive revision notes, videos and practice questions load below.