Home > Article > Web Front-end > html what are comments
In HTML, comments are explanations and explanations of the code. Its purpose is to allow people to understand the code more easily; comments are when writing a program, the person who writes the program gives a statement, program segment, function, etc. Explanations or tips can improve the readability of program code.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
Comments are explanations and explanations of the code, and their purpose is to make it easier for people to understand the code. Comments are when the programmer writes an explanation or hint for a statement, program segment, function, etc., which can improve the readability of the program code.
Correct program comments generally include preamble comments and functional comments.
The main contents of the preamble comments include the module interface, data description and module functions. The main content of the module's functional comments includes the function of the program segment, the function of the statement and the status of the data.
Comments can be divided into two types:
Line comments:
The line after the symbol will not be compiled ( Display)
Block comment:
The part in the middle of the block comment symbol will not be compiled
HTML Medium comment block comment
<!-- 注释内容 -->
Example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>html中的注释</title> </head> <body> <!--这是单行HTML注释 --> <!-- 这个例子是 HTML多行注释 --> <h1>这是文章标题</h1> <p>这是一个段落</p> </body> </html>
Recommended tutorial: "html video tutorial"
The above is the detailed content of html what are comments. For more information, please follow other related articles on the PHP Chinese website!