What do HTML comments do?

(*-*)浩
Release: 2019-08-24 15:21:17
Original
3599 people have browsed it

Comment tags are used to insert comments in HTML.

What do HTML comments do?

HTML comment tag(Recommended learning: HTML introductory tutorial)

You can pass The following syntax adds comments to the HTML source code:

Example

<!-- 在此处写注释 -->
Copy after login

Note: has an exclamation point in the opening tag, but not in the closing tag.

The browser will not display comments, but it can help record your HTML document.

You can use comments to place notifications and reminders in HTML:

<!-- 这是一段注释 -->
<p>这是一个段落。</p>
<!-- 记得在此处添加信息 -->
Copy after login

Comments are also very helpful for HTML error correction, because you You can comment out HTML code one line at a time to search for errors :

<!-- 此刻不显示图片:
<img border="0" src="/i/tulip_ballade.jpg" alt="Tulip">
-->
Copy after login

Conditional comments

You may occasionally find conditional comments in HTML:

<!--[if IE 8]>
    .... some HTML here ....
<![endif]-->
Copy after login

Conditional comments define HTML tags that only Internet Explorer executes.

The above is the detailed content of What do HTML comments do?. 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