loading

HTML Entities


Reserved characters in HTML must be replaced with HTML entities:

  • < (less than) = &lt;
  • > (greather than) = &gt;

Html Entities, Reserved Characters, Non-Breaking Space, Diacritical Marks, Html Character Entities

HTML Character Entities

In HTML, certain characters are reserved.

The browser may mix up tags and less than (<) or greater than (>) signals if you use them in your HTML text.

Reserved HTML characters can be displayed using entity names or entity numbers.

These are the names of entities:

				
					&entity_name;
				
			

Entity numbers look like this:

				
					&#entity_number;
				
			

To display a less than sign (<) we must write: &lt; or &#60;

Non-breaking Space

The non-breaking space is an HTML object that is frequently used: &nbsp;

A space that doesn’t break into a new line is known as a non-breaking space.

A non-breaking gap between two words causes them to remain together rather than split into separate lines. When speaking out loud could be disruptive, this is helpful.

Examples:

  • 10
  • 10 km/h
  • 10 PM

To stop browsers from truncating spaces in HTML documents, the non-breaking space is also frequently used.

The browser will eliminate nine spaces out of ten if you write them in your text. The &nbsp; character entity can be used to insert actual spaces into your text.

Some Useful HTML Character Entities

Result Description Name Number
non-breaking space &nbsp; &#160; Try it »
< less than &lt; &#60; Try it »
> greater than &gt; &#62; Try it »
& ampersand &amp; &#38; Try it »
" double quotation mark &quot; &#34; Try it »
' single quotation mark &apos; &#39; Try it »
¢ cent &cent; &#162; Try it »
£ pound &pound; &#163; Try it »
¥ yen &yen; &#165; Try it »
euro &euro; &#8364; Try it »
© copyright &copy; &#169; Try it »
® trademark &reg; &#174; Try it »

Combining Diacritical Marks

Adding a “glyph” to a letter is called a diacritical mark.

Accents refer to certain diacritical marks, such as grave ( ̀ )and acute ( ́ ).

To create a character that is not included in the character set (encoding) used on the page, diacritical markings can be combined with alphanumeric characters.

Here are some examples:

Mark Character Construct Result
 ̀ a a&#768; Try it »
 ́ a a&#769; Try it »
̂ a a&#770; Try it »
 ̃ a a&#771; Try it »
 ̀ O O&#768; Try it »
 ́ O O&#769; Try it »
̂ O O&#770; Try it »
 ̃ O O&#771; Try it »

HTML Entities

Reserved Characters

Non-breaking Space

Diacritical Marks

HTML Character Entities

HTML

HTML5

HTML tutorials

Learn HTML
Free HTML tutorials
HTML Example
HTML Explained

HTML Entities in HTML Coding

HTML entities are special characters used in HTML to display reserved characters that would otherwise be interpreted as HTML code. These entities are represented by a series of characters, beginning with an ampersand (&) and ending with a semicolon (;).

Some common uses of HTML entities include:

Reserved Characters: Certain characters like the less-than (<) and greater-than (>) signs have special meaning in HTML and need to be represented using entities like < and >.

Non-breaking Space: The non-breaking space entity ( ) is used to prevent a space from being collapsed or wrapped to the next line.

Diacritical Marks: Entities can be used to include accented characters and other diacritical marks that may not be easily typed on a standard keyboard, such as é for é.

HTML Character Entities: There is a comprehensive list of named character entities that can be used to represent a wide range of symbols and special characters in HTML.

Understanding and properly using HTML entities is an important part of writing clean, semantic HTML code. They ensure your content displays correctly and prevents unintended formatting issues.

 HTML Entities in HTML Coding

In HTML, certain characters have special meanings and cannot be used directly in the code. These characters are known as reserved characters. To display these characters, you need to use HTML entities, which are special codes that represent the character.

Some common HTML entities include:

– Non-breaking space ( )

– Copyright symbol (©)

– Trademark symbol (™)

– Registered trademark symbol (®)

– Diacritical marks like accents (é for é)

HTML entities start with an ampersand (&) and end with a semicolon (;). They are used to display reserved characters, as well as special symbols and characters that may not be available on all keyboards.

Understanding HTML entities is an important part of mastering HTML coding. They allow you to create properly formatted and displayed content on web pages.

Share this Doc

HTML Entities

Or copy link

Explore Topic