". All content between " " will be regarded as comments, and the syntax is " "; Comments are also part of the code, but the browser automatically ignores the content of the comments, so users cannot see the comments on the web page. Comments can appear anywhere in an HTML document, including at the beginning of the document, at the end of the document, in the middle of the document, outside the tag, within the tag content, etc."/> ". All content between " " will be regarded as comments, and the syntax is " "; Comments are also part of the code, but the browser automatically ignores the content of the comments, so users cannot see the comments on the web page. Comments can appear anywhere in an HTML document, including at the beginning of the document, at the end of the document, in the middle of the document, outside the tag, within the tag content, etc.">

Home>Article>Web Front-end> What is the html5 comment tag?

What is the html5 comment tag?

青灯夜游
青灯夜游 Original
2021-12-23 16:52:36 6093browse

html5 comment tag is "", everything between "" will be regarded as a comment, the syntax "< ;!-- Comment content -->”; Comments are also part of the code, but the browser will automatically ignore the content of the comments, so users cannot see the comments on the web page. Comments can appear anywhere in an HTML document, including at the beginning of the document, at the end of the document, in the middle of the document, outside the tag, within the tag content, etc.

What is the html5 comment tag?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

HTML comments are mainly used to explain the code in the document. Comments are also part of the code, but the browser will automatically ignore the content of the comments, so users cannot see the comments on the web page. .

We should make good use of comments when writing code, because a complete HTML document often consists of hundreds or thousands of lines of code, and it may take a long time when we want to modify a certain part of it. Only then can you find the place you want to modify. With comments, it's different. We can divide the program into several parts according to functions or other conditions and mark them with comments. This can help you and others read your code and improve the readability of the code.

Single line comments

In HTML you can useIn code To add a comment, everything betweenwill be considered a comment. The sample code is as follows:

      HTML注释的写法 

欢迎来到php中文网学习HTML教程,请记住地址://m.sbmmt.com/

The running result is as follows:

What is the html5 comment tag?

Comments can appear anywhere in the HTML document, including the beginning of the document, the end of the document, and Middle, outside label, label content, medium.

Multi-line comments

We mainly demonstrated single-line comments earlier, but multi-line comments are also supported in HTML. The difference between multi-line comments and single-line comments is not big. We only need to ensure that the content of the comment is between, as shown below :

In addition to explaining the code, comments can also be used to annotate the code in the program. For example, when you don’t want a certain piece of code to be executed, you can comment it out first, so that the browser can This code will not be executed.

Related recommendations: "html video tutorial"

The above is the detailed content of What is the html5 comment 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