- HTML Tutorial
- HTML Introduction
- HTML Editors
- HTML Basic
- HTML Comments
- HTML Elements
- HTML Attributes
- HTML Id & Classes
- HTML Skeletal Tags
- HTML Heading Tags
- HTML Paragraph Tag
- HTML Line Break Tag
- HTML Pre Tag
- HTML Anchor Tag
- HTML Image Tag
- HTML Horizontal Line Tag
- HTML Inline & Block
- HTML Inline
- HTML Block
- HTML LInks
- HTML Images
- HTML Formatting
- HTML Head
- HTML Head
- HTML Title
- HTML Meta Elements
- HTML Favicon
- HTML Style
- HTML List
- HTML Lists
- HTML Unordered List
- HTML Ordered List
- HTML Description List
- HTML Table
- HTML Tables
- HTML Table Headers
- HTML Table Styling
- HTML Table Colgroup
- HTML Form
- HTML Forms
- HTML Form Elements
- HTML Form Attributes
- HTML Input Types
- HTML Input Attributes
- HTML Form Actions
- HTML Semantic
- HTML Semantics
- HTML Graphics & Media
- HTML Canvas
- HTML SVG
- HTML Video & Audio
- HTML Plug-ins
- iFrames in HTML
- HTML Miscellaneous Tags
- HTML Code Tag
- HTML Entities
- HTML Quotation
- HTML Global Attributes
- HTML Obsolete Tags
- HTML Emojis
- HTML Symbols
- HTML Events
- HTML Colors
HTML Symbols
In web development, you'll often need to display characters that aren't found on a standard keyboard—like the copyright symbol (©), the Euro sign (€), or mathematical operators. Furthermore, HTML uses certain characters (like < and >) to define tags. If you want to display these "reserved" characters as actual text on your page without confusing the browser, you need to use HTML symbols (also known as entities).
Syntax
HTML symbols can be included in your code using two primary formats. Both start with an ampersand (&) and end with a semicolon (;).
- Entity Name: A descriptive name that is easy for humans to remember.
Example:© - Entity Number: A numeric code (often related to Unicode) that the browser translates into a symbol.
Example:©
Both methods result in the same output: ©. While names are easier to read, numeric codes are sometimes more reliable for very obscure symbols that might not have a standardized name.
;) at the end of the entity. Without it, the browser may not recognize the code and will simply print the raw text (like ©) to the screen.
Table: Common HTML Symbols
<meta charset="UTF-8"> in your HTML <head>. This ensures that the browser correctly interprets the character set for the symbols and entities you use.
Example 1: Reserved and Special Characters
This example shows how to use symbols for standard website UI elements, such as footers, pricing tables, and navigation links.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Standard UI Symbols</title>
</head>
<body>
<!-- Using © for the footer -->
<footer>
<p>© 2024 Acme Corp. All Rights Reserved.</p>
</footer>
<!-- Using € for currency pricing -->
<div class="price-tag">
<p>Subscription: €19.99/month</p>
</div>
<!-- Using ← and → for navigation pagination -->
<nav>
<a href="#">← Older Posts</a> | <a href="#">Newer Posts →</a>
</nav>
</body>
</html>
Example 2: Mathematical Symbols
When writing technical or scientific documentation, HTML symbols provide a way to display formulas without needing complex image files or external libraries.
<!DOCTYPE html>
<html>
<head>
<title>Scientific Documentation</title>
</head>
<body>
<h2>Product Specifications</h2>
<p>Manufacturing Tolerance: ±0.05mm</p>
<h2>Math Reference</h2>
<p>The calculation for the side length is: √x<sup>2</sup></p>
<p>The loop is designed to run until <em>n</em> reaches ∞.</p>
</body>
</html>
Summary
HTML symbols are an essential tool for every developer's toolkit. They allow you to safely include reserved characters, currency signs, and mathematical notation without worrying about character encoding issues or keyboard limitations. By mastering both entity names and entity numbers, you can ensure your web content is accessible and renders perfectly across all devices and browsers. Use the reference table above as a shortcut for your next project!