HTML Comments | 99codes

HTML Comments


Remark is a bit of code which is overlooked by any internet browser. It is a decent practice to include remarks into your HTML code, particularly in complex archives, to demonstrate areas of a record, and some other notes to anybody taking a gander at the code. Remarks help you and others comprehend your code and expands code comprehensibility.

HTML remarks are put in the middle of <!- - ... - > labels. In this way, any substance set with-in <!- - ... - > labels will be treated as remark and will be totally overlooked by the program.

html comments

Example -



This will deliver the accompanying outcome without showing the substance given as a piece of remarks −



Valid and Invalid Comments -


Remarks don't settle which implies a remark can't be put inside another remark. Second the twofold dash grouping "- - " may not show up inside a remark aside from as a major aspect of the end - > tag. You should likewise ensure that there are no spaces in the beginning of remark string.

Example -


Here, the given remark is a legitimate remark and will be cleared off by the program.



This will produce the following result −





Be that as it may, following line is certifiably not a legitimate remark and will be shown by the program. This is on the grounds that there is a space between the left edge section and the outcry mark.



This will produce the following result −




Multiline Comments -


So far we have seen single line remarks, yet HTML underpins multi-line remarks too.

You can remark different lines by the extraordinary starting tag <!- - and finishing tag - > set before the main line and end of the last line as appeared in the given model underneath.

Example -



This will produce the following result −





Conditional Comments -


Contingent remarks just work in Internet Explorer (IE) on Windows however they are overlooked by different programs. They are upheld from Explorer 5 onwards, and you can utilize them to give restrictive guidelines to various adaptations of IE.

Example -




You will run over a circumstance where you should apply an alternate template dependent on various variants of Internet Explorer, in such circumstance contingent remarks will be useful.

Using Comments Tag -


There are not many programs that help <comment> tag to remark a piece of HTML code.

NOTE : The <comment> tag deplored in HTML5. Try not to utilize this component.

Example -



In the event that you are utilizing IE, at that point it will create following outcome −



In any case, on the off chance that you are not utilizing IE, at that point it will deliver following outcome −


 

Commenting Script Code -


Despite the fact that you will learn JavaScript with HTML, in a different instructional exercise, however here you should make a note that in the event that you are utilizing Java Script or VB Script in your HTML code then it is prescribed to put that content code inside legitimate HTML remarks so old programs can work appropriately.

Example -



This will produce the following result −




Commenting Style Sheets -


In spite of the fact that you will master utilizing templates with HTML in a different instructional exercise, yet here you should make a note that on the off chance that you are utilizing Cascading Style Sheet (CSS) in your HTML code then it is prescribed to put that template code inside legitimate HTML remarks so old programs can work appropriately.

Example -



This will produce the following result −




HTML Comments | 99codes HTML Comments | 99codes Reviewed by Arup Roy on March 29, 2019 Rating: 5

No comments:

Powered by Blogger.