Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What are HTML comments? How do I add comments?


May 29, 2021 Article blog



We often see comments on developer notes in a large piece of code, and many students are curious about it. I n today's article, the W3Cschool editor-in-chief describes what HTML notes are. How do we add comments?

What is a comment

Comments <!--......--> <!--......--> label notes that are used to insert note information into code. The contents of the comments do not appear in the browser.

Why comment?

The addition of comments facilitates developers' understanding and modification of the code in the future, the function of the code for other programmers, and the discovery of code errors during testing.

It is a good habit to annotate code, and it is especially important to annotate functional modules in website development.

How to add comments

<body>
	<!-- 这是一段文字 -->
	<p>w3cschool--编程狮</p>
</body>

Comments must be <!--......--> and the ellipsis is to add the text we need to comment on. The above code shows only w3cschool - programming lion text content, the rest is not displayed.

Here's what HTML comments are and how to add the full contents of HTML comments.