Home  >  Article  >  Web Front-end  >  How to use the html tag

tag

-->

How to use the html tag

silencement
silencementOriginal
2019-05-28 11:25:1310553browse

How to use the html <!--...--> tag

html 8f0e1a3c54056efb6030e652a6462cafTag definition and usage

Comment tags are used to insert in source code Note. Comments will not be displayed in the browser.

You can use comments to explain your code, which will help you edit the code at a later time. Especially useful when you write a lot of code.

It is also a good practice to use comment tags to hide scripts that are not supported by the browser (so that the script is not displayed as plain text):

<script type="text/javascript">
<!--
function displayMsg()
{
alert("Hello World!")
}
//-->
</script>

Comment: two lines at the end of the comment line The slash (//) is the JavaScript comment symbol. This prevents JavaScript from executing the --> tag.

Example

HTML Note:

<!--这是一段注释。注释不会在浏览器中显示。-->

<p>这是一段普通的段落。</p>

Browser support

All browsers Both support comment tags

Differences between HTML 4.01 and HTML5

None.

Standard attributes

Annotation tags do not support any standard attributes.

Event Properties

Annotation tags do not support any event properties.

The above is the detailed content of How to use the html tag. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more