Problem Statement
How do you write a comment in HTML?
Explanation
HTML comments are written using the syntax: less than, exclamation, dash dash, comment text, dash dash, greater than. Comments are not displayed in the browser. They are only visible in the source code. Comments are useful for adding notes to your code, explaining complex sections, temporarily hiding code during development, or leaving reminders for yourself or other developers. Good comments improve code maintainability and make it easier for others to understand your work. However, remember that comments are visible in the page source code, so never put sensitive information like passwords or API keys in comments. In professional development, well-commented code is considered a best practice.
Code Solution
SolutionRead Only
<!-- This is a single line comment --> <!-- This is a multi-line comment It can span multiple lines Useful for longer explanations --> <h1>Welcome</h1> <!-- TODO: Add navigation menu here --> <!-- <p>This paragraph is commented out</p> -->
