HTML comments
An HTML comment - text placed between <!-- and --> is ignored by the browser and never shown on the page.
Understanding HTML comments in HTML & CSS
What it does: Every HTML comment must begin with <!-- and end with -->. Anything in between is the comment text. The comment appears in the HTML file and can be read by anyone who views the source, but it is never rendered on the page. Content inside <!-- --> is ignored by the browser and never shown to the user. // is used for comments in JavaScript, not HTML. HTML comments always use <!-- and -->. HTML comments can span multiple lines - everything between <!-- and --> is commented out, regardless of line breaks. Nested comments are not valid HTML. The first --> encountered closes the comment, even if there is an inner <!--.
Common mistakes: The comment opening marker must be <!-- with no spaces between < and !--. Writing <! -- is invalid syntax. The opening comment marker must be <!-- with two hyphens. Writing <!- with only one hyphen is invalid syntax.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 1–12) and word search (Modules 1–23).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
<!-- -->Fill in the Blanks
Spot the Error
Student with a class code? Join your class →