Special Characters

Exercise

  1. In the "index.html" file, write the following code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My First Web Page</title>
</head>
<body>

</body>
</html>
  1. Save.
  2. If "Live Server" is not already running, right-click anywhere in the editor and select "Open with Live Server" from the context menu.
  3. Add the following between the opening and closing tags of the body:
<!-- Special Characters -->
<!-- Trademark Symbol -->
<p>Trademark &trade;</p>
<!-- Copyright Symbol -->
<p>Copyright &copy;</p>
  1. Save.
  2. In the browser, you should see the following:

  3. Exercise 7 Result

Code Walkthrough and Explanation


&trade;

Special character codes in HTML are used to display characters that are not included on a standard keyboard or are difficult to type. They are often used to display characters such as reserved HTML characters (e.g., < and >), special characters (e.g., copyright symbol), or foreign characters.

Each special character code in HTML is represented by a unique code, known as an entity code or entity reference that starts with an & symbol and ends with a ; symbol.

There are several lists of special character codes available online, such as the HTML Character Entity References on the W3Schools website - https://www.w3schools.com/html/html_symbols.asp

These lists provide a comprehensive reference of all the special character codes that can be used in HTML. It's important to note that some special characters can also be entered directly into HTML using Unicode but the entity code is the preferred method since it is more widely supported across different browsers and platforms.


Experiment with the Code


Video and Code References


Questions? Subscribe and ask in the video comments:



GitHub and Other References