How to Work with Special Characters in HTML

  • google plus

In Brief...

Special characters (i.e., characters that do not show up on your keyboard) can be added to HTML pages using entity names and numbers. You'll learn how to use HTML character entities in this how-to.

Take our Introduction to HTML Training course for free.

See the Course Outline and Register

Instructions

  1. Start with a simple HTML document, like the following:
    
    <!DOCTYPE HTML>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    
    </body>
    </html>
    
  2. Add a <footer> element to the <body> element. It's very common to put a copyright statement in the footer of a document, so we'll put one into this footer.
    
    <!DOCTYPE HTML>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    
    	<footer>copyright Webucator</footer>
    </body>
    </html>
    
  3. Insert a copyright symbol into the footer, using the HTML character entity name for the copyright symbol, &copy;, or use the numeric character entity, &#169.
    
    <!DOCTYPE HTML>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    
    	<footer>copyright &copy; Webucator</footer>
    </body>
    </html>
    
  4. Save the file and open it in a browser. Notice that the character entity is replaced with a copyright symbol (the letter c in a circle).
    Copyright Entity

The following table shows some of the more common character references.
common character entities

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, XML, Windows, Java, Adobe, HTML5, JavaScript, Angular, and much more. Check out our complete course catalog.

Categories

Courses

Author: Chris Minnick

Chris is a prolific author and trainer, and the CEO of WatzThis?. His published books include Writing Computer Code, JavaScript for Kids, Coding with JavaScript For Dummies, Beginning HTML5 and CSS3 For Dummies, Webkit For Dummies, CIW eCommerce Certification Bible, and New Riders' XHTML.

Discuss