Comments in HTML
Part of the Fundamentals section of Coddy's HTML journey — lesson 5 of 60.
Comments are notes in the code that don't appear on the web page. They are useful for:
- Explaining complex code
- Leaving notes for yourself or others
- Temporarily disabling code
In HTML, comments are written between <!-- and -->.
Here's an example:
<!-- This is a comment -->
<p>This is a paragraph.</p>Challenge
EasyAdd a comment inside the <body> tag with your name and today's date.
Cheat sheet
Comments in HTML are written between <!-- and --> and don't appear on the web page:
<!-- This is a comment -->
<p>This is a paragraph.</p>Comments are useful for explaining code, leaving notes, or temporarily disabling code.
Try it yourself
<!DOCTYPE html>
<html>
<body>
<p>The comment goes below this paragraph</p>
</body>
</html>This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1HTML Basics
What is HTML?Basic Structure of an HTMLTags and ElementsNesting and Closing TagsComments in HTML2Text and Formatting
HeadingsParagraphsLine BreaksBold and Italic TextBold and Italic AgainRecap - Formatting8Forms and Inputs Part 1
Form BasicsText InputsInput AttributesPassword FieldLabels for InputsRecap - Basic Form11Event Registration Page
Project OverviewHeader Section9Forms and Inputs Part 2
Radio ButtonsCheckboxesDropdownsButtonsButtons in FormsRecap - Forms #1Recap - Forms #2