Home >Web Front-end >HTML Tutorial >html insert comment tag in the source code

in the source code

-->

html insert comment tag in the source code

黄舟
黄舟Original
2017-11-04 09:28:553021browse

Example

HTML Comments:

<!--这是一段注释。注释不会在浏览器中显示。-->
<p>这是一段普通的段落。</p>

Browser support


IE

Firefox

Chrome

Safari

Opera


Comment tags are supported in all browsers.

Definition and Usage

The comment tag is used to insert comments in the source code. 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.

Differences between HTML 4.01 and HTML5

None.

StandardsAttributes

Comment tags do not support any standard attributes.

For more information about HTML standard attributes, visit Standard Attributes.

EventsProperties

Annotation tags do not support any event properties.

42051107ad3edb8ba5534a15dea35492

6c04bd5ca3fcae76e30b72ad730ca86d tag, the content displayed on the web page is placed here

The page to be displayed on the web page The content must be placed in the body tag.

HTML 8d0d9f613ee4a9219a4d7a4cb67e7ad3 Tag

The comment tag is used to insert comments in the source document. Comments are ignored by the browser. You can use comments to explain your code, which will help you edit the code at a later time.


The above is the detailed content of html insert comment tag in the source code. 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