Skip to content
Learn Netverks

Lesson

Step 11/58 19% through track

comments

Comments

Last reviewed May 28, 2026 Content v20260528
Track mode
iframe_html
Means
HTML preview sandbox
Reading
~2 min
Level
advanced

This lesson

This lesson teaches Comments—the ideas, syntax, and habits you need before moving on in HTML.

Without a solid grasp of Comments, you will repeat mistakes in HTML exercises and on real pages or scripts.

You will apply Comments in contexts like: Websites, hybrid apps, email templates, design systems, and CMS-driven content.

Read the lesson, edit HTML/CSS in the playground, press Run to preview, then answer the lesson MCQs. Also use the HTML reference desk when you need tag or attribute lookup.

When intermediate lessons feel comfortable and you are ready for production-style trade-offs.

HTML comments wrap between <!-- and -->. They are delivered to every visitor—treat them as public documentation.

Rules

  • Comments cannot nest; the first --> closes the comment.
  • Avoid -- inside comments (parser edge cases in SGML legacy).
  • Dynamic templates still leak comments to DevTools—never stash secrets.
<!-- Section: hero -->
<section id="hero">…</section>

Good uses

  • Explaining unusual markup decisions to teammates.
  • Temporarily isolating chunks during debugging (remove before release).

Better alternatives

  • Server-side comments or templating comments that never reach HTML output.
  • Git commit messages referencing ticket IDs.

Rare-but-painful pitfalls

  • Comments accidentally containing --> prematurely close sections—validators catch some cases, reviewers catch others.
  • Large commented-out bundles still download and parse—affecting Lighthouse HTML size budgets.

Rendered example

The comment itself is not visible in the page UI.

Visible section content

Important interview questions and answers

  1. Q: When should you use `strong` vs `b`?
    A: Use `strong` for semantic importance; use `b` only for stylistic offset without importance semantics.
  2. Q: Why is `target="_blank"` usually paired with `rel="noopener"`?
    A: It blocks the opened page from controlling the opener via `window.opener`, improving security.
  3. Q: Why avoid fake buttons built with ``?
    A: Anchors are for navigation; actions should use `

Pitfall: Comments are visible in View Source—never put secrets in HTML comments.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What confused you about this lesson?
  • How would you explain this to a teammate in 30 seconds?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump