HTML entities are special codes that allow you to display characters in your web pages that would otherwise be interpreted as HTML code. In this tutorial, we’ll cover the basics of HTML entities and how to use them in your web pages.
An HTML entity is a code that represents a special character or symbol. For example, the less than sign (<) can be represented by the HTML entity code
<. HTML entitity are used to display characters that are reserved for HTML, such as the less than and greater than signs, or that are not part of the standard ASCII character set.
Here are some common HTML entitity and their corresponding codes:
<– less than sign (<)
>– greater than sign (>)
&– ampersand (&)
"– double quotation mark (“)
'– single quotation mark or apostrophe (‘)
¢– cent sign (¢)
£– pound sign (£)
¥– yen sign (¥)
€– euro sign (€)
©– copyright symbol (©)
®– registered trademark symbol (®)
™– trademark symbol (™)
–– en dash (–)
—– em dash (—)
– non-breaking space
To use an HTML entity in your web page, simply replace the special character with its corresponding HTML entity code. For example, to display the copyright symbol, you would use the HTML entity code
©. Here’s an example:
<p>© 2023 My Company, Inc.</p>
In the above example, we have used the HTML entity code
© to display the copyright symbol in the paragraph element.
So that, HTML entities are a useful tool for displaying special characters and symbols in your web pages. By using HTML entitity, you can ensure that your content is displayed correctly across all devices and browsers. Remember to always use the correct HTML entity code for the character or symbol you want to display.