How to write comments in HTML? What are the comment symbols in HTML? (attached example)

Source: Internet
Author: User
Tags html comment
This article mainly introduces the comment symbols in the HTML, the notation symbol and the annotation symbol instance parsing, next let's look at this article together

The first thing we need to know is what is the comment symbol in HTML?

The comment label is used to insert comments in the source code. Comments are not displayed in the browser.

You can use annotations to interpret your code to help you edit the code at a later time. This is especially useful when you are writing a lot of code.

It is also a good practice to use comment tags to hide scripts that are not supported by browsers (so that scripts are not displayed as plain text)

Note: The two slash (//) at the end of the comment line is a JavaScript comment symbol. This avoids JavaScript execution and tagging.

Here is an example of a comment:

<!--This is a comment--><p> this is a paragraph. topic.alibabacloud.com</p><!--Remember to add information here--

This example does not have to look at it, it is obvious that this in the browser will only be the contents of the <p> tag, the other two lines are not displayed at all, because this is for others to see, will not be mistaken by the browser.

Another benefit: The release is also helpful for HTML error correction because you can comment one line of HTML code at a time to search for errors:

Here are some examples of annotations:

<!--don't show pictures now: -->

Conditional comments for HTML annotations:

You may occasionally find conditional annotations in HTML:

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

Conditional annotations Define only HTML tags that are executed by Internet Explorer.

HTML software program tags for annotations:

Various HTML software programs can also generate HTML annotations.

For example, <!--WebBot bot--> tags are enclosed in HTML annotations created by FrontPage and Expression Web.

As a rule, the presence of these tags helps support the software that creates these tags.

About the symbols and wording of HTML annotations:

One, in the HTML page comment syntax:

<!--comment Content--

Second, the comment code splitting analysis

The HTML comment code begins with the following:

<!--"less than sign + exclamation mark + two small bars (minus) end"-

Two small bars (minus sign) + greater than symbol

Third, how to write HTML comments

<!--I was in the HTML comment--

The above is about the content of the HTML comments all resolved, the problem can be asked below

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.