Home  >  Article  >  Web Front-end  >  What do HTML comments do?

What do HTML comments do?

(*-*)浩
(*-*)浩Original
2019-08-24 15:21:173598browse

Comment tags 0f22cfdea9b4f9815ce45283dc15856e 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

<!-- 在此处写注释 -->

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>
<!-- 记得在此处添加信息 -->

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">
-->

Conditional comments

You may occasionally find conditional comments in HTML:

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

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!

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