HTML comments are enclosed within <!-- and --> tags.
<!-- This is an HTML comment -->
In HTML, Comments are used to include notes or remarks within the code that are not displayed on the web page.
Comments are intended for developers and serve as a way to document and explain the purpose of specific code segments. HTML comments do not affect the rendering of the page and are ignored by web browsers.
<!-- This is an HTML comment -->
Comments provide a way to document the code, explaining its purpose or functionality.
They help other developers (or even yourself in the future) understand the code.
We can use comments to temporarily disable or "comment out" a piece of code without deleting it.
Comments can be used for debugging purposes, allowing us to identify and isolate specific sections of code.
<!-- This is a single-line comment --> <p>This is a paragraph of text.</p>
<!-- This is a multi-line comment --> <div> <p>Content inside a div.</p> </div>
<!-- <p>This paragraph is commented out.</p> -->
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Web Page</title> <!-- External stylesheet link --> <link rel="stylesheet" href="styles.css"> </head> <body> <!-- Header section --> <header> <h1>Welcome to My Web Page</h1> <!-- Navigation menu --> <nav> <ul> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav> </header> <!-- Main content section --> <main> <!-- Article 1 --> <article> <h2>Article 1</h2> <p>This is the content of the first article.</p> </article> <!-- Article 2 --> <article> <h2>Article 2</h2> <p>This is the content of the second article.</p> </article> </main> <!-- Footer section --> <footer> <p>© 2022 My Web Page. All rights reserved.</p> </footer> </body> </html>