HTML Comments – How to Insert Comments in HTML

0
218
HTML Comments

In this tutorials you will learn about HTML comments. Why comments is important in HTML code and how you can insert HTML comments.

Why Comments is Important in HTML Coding ?

When HTML code goes too long in writing headings , paragraphs and other markup it becomes very hard to manage. Sometimes you even don’t know from where a tag is starting and where it is ending. So to solve this problem you can insert comments inside you HTML code. Remember that your web page will not be effected by comments. Comments is only for you to remind you which tag was written for which purpose.

Syntax of Writing Comment in HTML

<!—    Your Comment Here   —->

This is how you can write comment in HTML. This will only be seen in code not in browser.

Suppose you have following code in your web page.

Example Comments

Now if your page has 10 headings after this then you have to spend time to go to a specific paragraph. You can comment in your HTML code to see which paragraph is for what. See Example below.

Comment Example in HTML

You can see comments in above code. These comment will not appear in browser. This is just for web designers to enhance the readability of the code.

LEAVE A REPLY

Please enter your comment!
Please enter your name here