Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Competitions › SOF ICSO › unit 12 of 16

HTML and web pages

SOF ICSO · Computer Science · about 5 minutes

Web pages are written in HTML using tags in angle brackets. Most tags come in pairs: <p> … </p>.

Questions ask what a tag does, which tag makes a link or image, and how tags nest.

In this lesson

  1. Structure
  2. Attributes
  3. Worked examples
  4. Where marks are lost
  5. Check yourself

1Structure

Every page has <html>, a <head> (title, settings) and a <body> (what you see). Tags nest like boxes: close the inner one before the outer one.

2Attributes

Attributes add details inside the opening tag: <img src="cat.jpg" alt="A sleeping cat">. The alt text is read aloud for blind users and shown if the image fails.

Worked examples

  1. Example 1What is wrong with <b><i>Hi</b></i>?

    1. The tags overlap instead of nesting.

    Answer: Close </i> before </b>

See it move

Where marks are lost

  • Putting visible content in <head>.
  • Forgetting closing tags.

Exam tips

  • <h1> to <h6> are headings; <p> is a paragraph; <br> is a line break.
  • <a href="…"> makes a link; <img src="…"> shows an image.
  • <ul> and <ol> make lists with <li> items.

Practice questions

  1. Which tag makes a hyperlink?

  2. Which is the largest heading?

  3. A numbered list uses…

More worked examples

Try each one first, then open the working.

  1. What is the parent of each <li> element?

    htmlheadtitlebodyh1pullilililili
    1. A<ul>
    2. B<p>
    3. C<body>
    4. D<html>
    Show the working

    Start: Follow the line up one level.

    List items sit inside the list.

    Answer: <ul>

  2. How many children does the <body> element have?

    htmlheadtitlebodyh1pullililili
    Show the working

    Start: Count only the elements directly below body.

    <h1>, 1 <p> and one <ul>: 3.

    Answer: 3

  3. How many children does the <body> element have?

    htmlheadtitlebodyh1pppullililili
    Show the working

    Start: Count only the elements directly below body.

    <h1>, 3 <p> and one <ul>: 5.

    Answer: 5

  4. How many children does the <body> element have?

    htmlheadtitlebodyh1ppullili
    Show the working

    Start: Count only the elements directly below body.

    <h1>, 2 <p> and one <ul>: 4.

    Answer: 4

Practise more

New questions every time, at exam level

How many children does the <body> element have?

htmlheadtitlebodyh1pullililili

Learn it properly

Full chapters with animations, each with an “Explained simply” version.

  • Web pages with HTMLClass 8

Sit a timed SOF ICSO mock test

Spreadsheets and formulasNext: Cyber safety and security