HTML Entity List
HTML Entity List
HTML entities are a set of special symbols and characters that aren't readily available on our keyboards. These entities are used to display reserved characters, invisible characters, and other special symbols which are not possible to type directly into your HTML code.
The HTML document uses a specific set of symbols that have special meanings. For instance, when you use the less than <
or greater than >
signs in an HTML document, the browser will interpret those symbols as tags. If you want to display these characters as they are, you would use HTML entities.
The Syntax of HTML Entities
HTML entities start with an ampersand &
and end with a semicolon ;
. They are usually named after their character, but they can also be referred to by their numerical code.
Here's an example of how HTML entities are represented:
- Less than:
<
- Greater than:
>
- Ampersand:
&
Common HTML Entities
Here are some of the commonly used HTML entities:
"
for "'
for '&
for &<
for <>
for >
for a non-breaking space©
for ©®
for ®€
for €
Non-breaking Space Entity
The most frequently used HTML entity is the non-breaking space:
. This entity helps to create extra spaces that are not stripped away by the browser.
Here's an example:
<p>This sentence has a lot of space in the middle.</p>
This will render as:
This sentence has a lot of space in the middle.
Without the non-breaking spaces, the HTML would render multiple spaces as a single space.
Using Entities for Special Characters
Entities are also handy for displaying special characters that are not present on the keyboard. For instance, you can use entities to display arrows, mathematical symbols, Greek letters, and more.
Here are a few examples:
♥
for ♥™
for ™π
for πα
for α→
for →
There are hundreds of HTML entities that you can use to represent these special characters.
Conclusion
HTML entities are an essential part of HTML, and they allow you to display special characters and symbols that you cannot type directly into your code. Understanding how to use these entities is important as it increases your versatility as a web designer or developer.
Remember, every entity begins with an ampersand (&) and ends with a semicolon (;). If you ever need to display a special character, chances are there's an entity you can use. Happy coding!