HTML Basics Tutorial (6)--html entity

Source: Internet
Author: User

Symbols such as "<" have special meanings in HTML, so they are used in text.

In order to display the less-than sign (<) in HTML, we need to use the character entity.

Character entity

Some characters have special meanings in HTML, such as the less than sign (<), which defines the beginning of the HTML tag. If we want the browser to display these characters correctly, we must insert the character entities in the HTML source.

The character entity has three parts: a number (&), an entity name, or # and an entity number, and a semicolon (;).

To display the less-than sign in the HTML document, we need to write this:&lt; or & #60;

The advantage of using entity names instead of entity numbers is that names are relatively easier to remember. The downside to this is that not all browsers support the latest entity names, but almost all browsers support the entity numbers very well.

Note: The entity is case sensitive.

Experiment with character entities yourself. (IE only supported)

<HTML><Body><P>This is a character entity:& #000;</P><P>you can try using another number (such as 169) in the edit window instead of 000, and then click the Tiy button to see the results. </P></Body></HTML>

Space

Spaces are the most common character entities in HTML.

Typically, HTML will cut the space in the document. If you enter 10 consecutive spaces in a document, the HTML will remove 9 of them. If you use it, you can add spaces to the document.

Most commonly used character entities
Show Results Description Entity name Entity number
Space &nbsp; & #160;
< Less than sign &lt; & #60;
> Greater than sign &gt; & #62;
& and number &amp; & #38;
" Quotes &quot; & #34;
Apostrophe &apos; (ie not supported) & #39;

Some other commonly used character entities
Show Results Description Entity name Entity number
Score of &cent; & #162;
£ Pounds &pound; & #163;
¥ Yen &yen; & #165;
§ Section &sect; & #167;
© Copyright &copy; & #169;
® Registered trademarks &reg; & #174;
X Multiplication sign &times; & #215;
÷ Division Sign &divide; & #247;

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.