Special characters & Comments

Special Characters

In your HTML code there will be times you want to use a special character - as in foreign languages, or other types of symbols such as mathematical ones

Here are codes for some special symbols

♥

To do this you cannot just type them into your code. Why not? One reason is that certain characters are set aside to mean something in the programming code. For example - what if you need to show a this < in your page? In the code it indicates something else to the browser.

There are codes that tell the browser to display the characters. For instance - in order to get the tag symbol to appear in my code I entered: 

&lt;

This puts the less than sign into the page. 

Another popular code is to create a non-breaking space. You may have noticed that if you put more than one space between words in your code that when it displays there is only one. How do you add extra spaces if you want them? Just put in the code for a non-breaking space: 

&nbsp;

These can be strung together if you need several spaces: 

&nbsp;&nbsp;&nbsp;&nbsp;

Where can you find these codes? 

There are many online sources - but W3C Schools has pretty thorough lists.

W3C HTML ENTITES AND SYMBOLS


Comments

You've already seen these in CodeHS but it is time to start making use of them. One place in particular that they are useful is noting which DIV tags are being closed. It gets confusing at times to know which ones belong to which opening div.

<!-- this is how a comment starts and ends -->

I use them a lot in the closing div tags to keep track

<!-- closing content div -->
             </div>

<!-- closing container div -->

         </div>