html what are comments

青灯夜游
Release: 2023-01-05 16:14:28
Original
8715 people have browsed it

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.

html what are comments

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

<!-- 注释内容  -->
Copy after login

Example:

<!DOCTYPE html>
<html>
<head>
   <meta charset="UTF-8">
   <title>html中的注释</title>
</head>
<body>  
   <!--这是单行HTML注释 -->
   <!-- 这个例子是
        HTML多行注释  -->
   <h1>这是文章标题</h1>
   <p>这是一个段落</p>
</body>
</html>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template