KEMBAR78
HTML Comments | PDF | Html | Html Element
0% found this document useful (0 votes)
12 views6 pages

HTML Comments

HTML comments are used to document source code and are not displayed in the browser. They can also hide content temporarily and assist in debugging by allowing developers to comment out lines of code. The correct syntax for HTML comments is <!-- comment here -->.

Uploaded by

Sentinel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

HTML Comments

HTML comments are used to document source code and are not displayed in the browser. They can also hide content temporarily and assist in debugging by allowing developers to comment out lines of code. The correct syntax for HTML comments is <!-- comment here -->.

Uploaded by

Sentinel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

13/07/2025, 18:28 HTML Comments

 Tutorials  Exercises  Services   Sign In

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C

HTML Comments
❮ Previous Next ❯

HTML comments are not displayed in the browser, but they can help document
your HTML source code.

HTML Comment Tag


You can add comments to your HTML source by using the following syntax:

<!-- Write your comments here -->

Notice that there is an exclamation point (!) in the start tag, but not in the end tag.

Note: Comments are not displayed by the browser, but they can help document your
HTML source code.

Add Comments
With comments you can place notifications and reminders in your HTML code:

Example

<!-- This is a comment -->

<p>This is a paragraph.</p>
https://www.w3schools.com/html/html_comments.asp 1/6
13/07/2025, 18:28 HTML Comments

<!-- Remember
Tutorials  to add
Exercises Services here -->
more information  Sign In

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
Try it Yourself »

Hide Content
Comments can be used to hide content.

This can be helpful if you hide content temporarily:

Example

<p>This is a paragraph.</p>

<!-- <p>This is another paragraph </p> -->

<p>This is a paragraph too.</p>

Try it Yourself »

You can also hide more than one line. Everything between the <!-- and the --> will
be hidden from the display.

Example
Hide a section of HTML code:

<p>This is a paragraph.</p>
<!--
<p>Look at this cool image:</p>
<img border="0" src="pic_trulli.jpg" alt="Trulli">
-->
<p>This is a paragraph too.</p>

Try it Yourself »

https://www.w3schools.com/html/html_comments.asp 2/6
13/07/2025, 18:28 HTML Comments

Comments are also great for debugging HTML, because you can comment out HTML
 lines of Tutorials
code, one  at aExercises Services
time, to search 
for errors.  Sign In

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C

Hide Inline Content


Comments can be used to hide parts in the middle of the HTML code.

Example
Hide a part of a paragraph:

<p>This <!-- great text --> is a paragraph.</p>

Try it Yourself »

?
Exercise
What is the correct syntax for adding a comment in HTML?

<-- This is a comment -->

<## This is a comment ##>

<--> This is a comment </-->

<!-- This is a comment -->

Submit Answer »

Video: HTML Comments

https://www.w3schools.com/html/html_comments.asp 3/6
13/07/2025, 18:28 HTML Comments

 Tutorials  Exercises  Services   Sign In

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C

❮ Previous Next ❯

Track your progress - it's free! Sign Up Log in

COLOR PICKER
https://www.w3schools.com/html/html_comments.asp 4/6
13/07/2025, 18:28 HTML Comments

 Tutorials  Exercises  Services   Sign In

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C



 PLUS SPACES

GET CERTIFIED FOR TEACHERS

FOR BUSINESS CONTACT US

Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial

Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference

https://www.w3schools.com/html/html_comments.asp 5/6
13/07/2025, 18:28 HTML Comments

Top Examples Get Certified


 Tutorials  Exercises  Services   Sign In
HTML Examples HTML Certificate
HTML
 CSS CSS Examples SQL
JAVASCRIPT PYTHON JAVA PHP CSSHOW Certificate
TO W3.CSS C
JavaScript Examples JavaScript Certificate
How To Examples Front End Certificate
SQL Examples SQL Certificate
Python Examples Python Certificate
W3.CSS Examples PHP Certificate
Bootstrap Examples jQuery Certificate
PHP Examples Java Certificate
Java Examples C++ Certificate
XML Examples C# Certificate
jQuery Examples XML Certificate

    

FORUM ABOUT ACADEMY


W3Schools is optimized for learning and training. Examples might be simplified to improve
reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot
warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of
use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by


W3.CSS.

https://www.w3schools.com/html/html_comments.asp 6/6

You might also like