In HTML, many of the web pages you create will require special characters such as a copyright symbol, trademark symbol, and registered symbol, etc. To display these special characters; you use character entities. In this HTML tutorial, you'll learn how to code character entities.
Common HTML Character Entities
Entity | Character |
---|---|
& | & |
< | < |
> | > |
© | © |
® | ® |
™ | ™ |
¢ | ¢ |
° | ° |
± | ± |
‘ | ' (opening single quote) |
’ | ' (closing single quote) |
“ | “ (opening double quote) |
” | ” (closing double quote) |
| A non-breaking space. |
Notes on HTML Character Entities
- All character entities start with an ampersand (&) and end with a semicolon (;). Then the rest of the entity identifies the character it represents.
- Character entities can be used to display special characters in an HTML document.
- HTML provides a variety of character entities in addition to the ones above.
Example
<html lang="en"> <head> <style> body { background-color: #ffaec8; } </style> </head> <body> <h1>HTML Character Entities</h1> <h3>Closing Single Quote</h3> <p>It’s time to start your Christmas shopping.</p> <h3>Opening and Closing Double Quotes</h3> <p>President John F. Kennedy said, “ And so, my fellow Americans, <br> ask not what your country can do for you; ask what you can do for your <br> country.” </p> <h3>Non-Breaking Space</h3> <p> Turning fear into hope, medical futurist Dr. Alan J. Russell will <br> discuss the science of regenerating damaged or diseased human body parts, while offering real <br> hope for the future <br> of human health.</p> <h3>Copyright and Ampersand</h3> <p>© 2019 John Loney & Associates, Inc.</p> </body> </html>
Output
The output would be as shown in the featured image of this article.