21. HTML Character Entities

HTML Chapter Entities

Character Entities
Nonbreaking Space
Commonly used Character Entites

Character Entities

Some characters are reserved in HTML.
A character entity looks like this: &entity_name; or &#entity_number;

To display a less than sign, you must write: < ot <

advantage: using an entity name instead of a number is that te name often is esier to remember.
disadvantage: browsers may not support all entity names (while the support of entity numbers is very good)

<html>
<body>
<h1>character entities</h1>
<p>Code: &x;</p>
<p> substitute the x with a n entity number like "#174" or an entity name like "pound" to see the result. use the table in the next section to try different character entities.
</p>
</body>
</html>

Nonbreaking Space

To add lots of spaces to your text, use the &nbsp; character entity.

Commonly used character entities

Description Entity name Entity number
nonbreaking space &nbsp; &#160;
less than &lt; &#60;
greater than &gt; &#62;
ampersand &amp; &#38;
cent &cent; &#162;
pound &pound; &#163;
yen &yen; &#165;
euro &euro; &#8364;
section &sect; &#167;
copyright &copy; &#169;
rigistered trademark &reg; &#174;

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams