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.
Structure
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.
Attributes
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
Example 1What is wrong with <b><i>Hi</b></i>?
- 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
Which tag makes a hyperlink?
Which is the largest heading?
A numbered list uses…
More worked examples
Try each one first, then open the working.
What is the parent of each <li> element?
- A<ul>
- B<p>
- C<body>
- D<html>
Show the working
Start: Follow the line up one level.
List items sit inside the list.
Answer: <ul>
How many children does the <body> element have?
Show the working
Start: Count only the elements directly below body.
<h1>, 1 <p> and one <ul>: 3.
Answer: 3
How many children does the <body> element have?
Show the working
Start: Count only the elements directly below body.
<h1>, 3 <p> and one <ul>: 5.
Answer: 5
How many children does the <body> element have?
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?
Learn it properly
Full chapters with animations, each with an “Explained simply” version.