One, HTML annotation method <!--HTML comment: START-to-content <!--HTML comment: END-to
The content that is contained between <!--and--is ignored by the browser and is not displayed in the user's browsing final interface.
The part of the comment is ignored while the browser is executing, but you can still see it when you view the source code in the browser
Second, the CSS annotation method <style type= "TEXT/CSS" >/* CSS comments */</style>
This method annotation is also used in a separate CSS style sheet file
three, JS annotation method <script type= "Text/javascript" >//js single-line annotation mode
/*
This is JavaScript.
Multi-line Comment mode
*/</script>
Write in JS
<!--
-
The roles and causes are as follows:
JavaScript recognizes the beginning of the HTML comment "<!--", and JavaScript ends it as a single-line comment, as with "//". But JavaScript does not recognize the result part of the HTML comment "--".
Therefore, if the first line starts with "<!--" and the last line ends with "//-->", JavaScript ignores both lines without ignoring the parts between the two rows. And if in JavaScript, the first line starts with "<!--",
The last line ends with "--" and the program is included in a full HTML comment that is ignored by browsers that do not support JavaScript and cannot be displayed.
In this way, you can hide code for browsers that don't understand JavaScript, and browsers that understand JavaScript don't have to be hidden.
Ps:
Where HTML comments are added to CSS (style) or JavaScript (script) code <!––> is to prevent the lower version of the browser from not supporting style and script code, and displayed in the page.
A browser that supports style will ignore the <!– tag and use the style sheet normally.
Comments in HTML CSS and JS