Comments in HTML 5
Comments are used to identify sections of code or text that are to be ignored by HTML parsers. There are various reasons for adding comments to HTML code, for example:
- to identify sections of HTML code, or include some informational or descriptive text
- to comment out HTML code that is in error or no longer relevant
- to provide an easy way to make changes to a web page for HTML code testing or A/B/multivariate testing in marketing analysis of web designs
Any text, scripts or HTML code within properly coded comments will be ignored. However, if comments are coded where not expected, such as in text content, what looks like comments is sometimes treated as text, which will not be ignored.