Comments in HTML
A free lesson from Swipe Coding · HTML, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
HTML comments let you leave notes in your code that browsers completely ignore when rendering the page. They start with <!-- and end with -->, and anything in between is invisible to visitors.
<!-- This is the site navigation --> <nav> <a href="/">Home</a> </nav>
Comments are useful for labeling sections of a longer page ('this is the header,' 'this is the footer'), leaving reminders about something that needs fixing later, or temporarily disabling a piece of HTML without deleting it while testing.
One thing worth knowing: HTML comments are not truly hidden. Anyone can view a page's source code and read every comment in it. Never put anything sensitive — passwords, private notes, internal-only information — inside an HTML comment.
How does an HTML comment begin and end?
Content inside an HTML comment is invisible on the rendered page, but anyone can still see it by viewing the page ____.
It is safe to put a password or private note inside an HTML comment, since browsers never display it.
The Shape of an HTML Document
10 questions · pass with 60% — just like in the app.
What is the correct HTML5 doctype declaration?
<!DOCTYPE html>
The doctype declaration should be placed at the very top of an HTML file, before anything else.
The ____ element holds everything a visitor actually sees on the page — text, images, buttons, and links.
What are the two direct children of the <html> element?
A single tag can only ever have one attribute.
A(n) ____ is a tag together with everything inside it, from the opening tag to the closing tag.
Which of these is a self-closing (void) element that never needs a closing tag?
<p>Some <strong>text</p></strong> is correctly nested HTML.
How does an HTML comment begin and end?
It is safe to put a password or private note inside an HTML comment, since browsers never display it.
Keep your streak going in Swipe Coding
Swipe through every level of HTML on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →