B4Coder
0%
LessonAbout 4 min

Chapter 1 · Lesson 3 of 4

03. Notes in your HTML

<!-- comments --> are notes for people reading your HTML: the browser doesn't show them.

Like Python's #, HTML has comments: notes for people, which the browser skips. A comment starts with <!-- and ends with -->, and can cover several lines.

HTML
<!-- The top of the page --><h1>Sports Day</h1><!-- <p>Sports Day is cancelled.</p> --><p>See you on the field at 9!</p>

The second paragraph is inside a comment, so it's switched off: still in the file, but not on the page.

Your turn

1Steps

  1. 1Add a comment at the top that says what the page is (any words).
  2. 2The paragraph about the old date is wrong: don't delete it, turn it into a comment so it doesn't show.

Write it in index.html; the page shows as you type.

Starting code

The editor starts empty. Copy this into it to begin, or write your own from scratch.

HTML
<h1>Science Fair</h1><p>The fair is on Monday.</p><p>The fair is on Friday at 10 am.</p>

2Expected output

Your page should have

  • The page starts with a comment
  • Only one paragraph shows
  • The paragraph that shows is the Friday one
  • The Monday paragraph is still in the file (in a comment)

Submit answer checks each of these.

3Hints

Stuck? Open one hint at a time: each gives a bit more help.

Hint 1

A comment is anything between <!-- and -->.

Hint 2

Put <!-- just before <p>The fair is on Monday.</p> and --> just after it.

Hint 3

For the first line, something like <!-- My Science Fair page --> above the heading.