Multiple Line Comments and Conditional comments in HTML Document

Multiple Line Comments and Conditional comments in HTML Document-It is a good practice to give comments while writing an HTML document. Comments in an HTML document are very useful , these help the person other than the creator and sometimes to the writer himself while checking or modifying his old documents because it is not possible for any body to remember an entire HTML document. I am discussing here about the multiline comments and Conditional comments. You can read simple comment in an HTML Document here –



Multiple Line comments in an HTML document

You can put a Multiple Line comments in an HTML document by using the special beginning or starter tag <!-- and ending or closing tag --> placed before the first line and at the of the last line to be treated as a comment. You can insert as many line as you like and If all the line of your comment are not of equal length you can use the line breaking element(<br> tag) which gives the line breaking result(like Carriage Return). This is very useful  while writing something like an address or so.


Please note that the line breaking element(<br> tag) must not used to increase the gap between lines of text, for this purpose you can use the CSS margin property or the <p> tag.
An example of multiple Line HTML comment without gap between lines

<!--This is a multiline comment <br> Second line <br > Third line <br> -->

See the example of multiple Line HTML comment with gap between lines
               <p>
The comment with gap in lines<br> Second line <br > Third line <br>
               </p>

Conditional comments in an HTML document

Conditional comments work only in Windows Internet Explorer versions 6 to version 9. Thus you can give conditional comments meant for Windows Internet Explorer only. The basic structure of the conditional comments is the same as an HTML comment (<!-- -->). Therefore all other browsers will ignore them entirely, assuming them as normal comments.

An Example of Conditional comments in an HTML document

<!--[if IE 9]>

Write your conditions here

<![endif]-->

In above line Number 1 there may be any number from IE 6 to IE 9 and versions IE10 or above have different arrangements)

 



Reactions:

2 comments:

  1. Though I am not an expert in this markingup computer language but Comments in an HTML document are very usefulto help the person other than the creator and sometimes to the writer himself while checking or modifying his old documents. It is a fact that it is not possible for any body to remember an entire HTML document. The article is good

    ReplyDelete
  2. Comments in HTML are very useful specially at the time of editing the existing HTML script.

    ReplyDelete