Grade 7 Computer Science — HTML attributes and links
Read the attributes inside an opening tag, and work out where a link goes and which words a reader clicks to follow it.
Name: ________________________
1.A page holds “<a href="library.html">Books</a>”. Which piece is the link text and which is the destination?
- a) Both pieces are the destination
- b) Both pieces are the text
- c) Books is the text; library.html is the destination
- d) library.html is the text; Books is the destination
2.An attribute is a name, an equals sign and a value in quotes, written inside the opening tag. How many attributes does “<img src="cat.png" alt="A cat" width="200">” have?
3.In the picture tag “<img src="kite.png" alt="A paper kite">”, which file holds the picture?
4.Match each attribute name to what it says.
- href
- src
- alt
- width
- How wide to draw a picture
- Which page the link opens
- Which file a picture comes from
- Words to use in place of a picture
5.Which of these is written as an attribute usually is — a name, an equals sign, then a value inside quotes?
- a) "href"=home.html
- b) href="home.html"
- c) href home.html
- d) href-home.html
6.In the picture tag “<img src="kite.png" alt="A paper kite">”, what is the alt attribute for?
- a) The size the picture should be drawn at
- b) Words describing the picture, for a reader who cannot see it
- c) The page the picture links to
- d) The name the picture is saved under
7.A page holds “<a href="one.html">First</a> and <a href="two.html">Second</a> and <a href="three.html">Third</a> and <a href="four.html">Fourth</a>”. How many links is that?
8.Sort each opening tag by whether it carries an attribute.
Groups: Carries an attribute · Carries none
- <b>
- <img src="sun.png">
- <h1>
- <p>
- <a href="math.html">
- <a href="home.html">
Answer key — Grade 7 Computer Science — HTML attributes and links
- 1. c) Books is the text; library.html is the destination
- 2. 3
- 3. kite.png
- 4. href → Which page the link opens; src → Which file a picture comes from; alt → Words to use in place of a picture; width → How wide to draw a picture
- 5. b) href="home.html"
- 6. b) Words describing the picture, for a reader who cannot see it
- 7. 4
- 8. <p> → Carries none; <a href="home.html"> → Carries an attribute; <img src="sun.png"> → Carries an attribute; <b> → Carries none; <h1> → Carries none; <a href="math.html"> → Carries an attribute