In every programming language there is the possibility to add explanatory text in the form of comments to the code. Comments are only visible to the programmer and are not displayed in the running program. Here you can find out how to add such comments to HTML code.

A comment in HTML is opened with <!-- and closed again with -->. Comments could look like this:

<!-- Comment -->

Comments are highlighted in the code and are used to explain your own code or to assign headings to it. When executing the program, the comments in the code are skipped.

Using Comments

An usage for comments can be wherever it becomes difficult without comments to change the code later at the right spot.

An example for this can be found on the number13 games page. On this page is a HTML table with screenshots and links to various pages. To edit the table later, it is tedious to go through the whole code again in order to make changes in the right place. Comments make it obvious quickly where you are in the code.

Here is an excerpt from the first two lines of the table:

Cities Skylines RimWorld

To make the code easier to understand, I added comments in front of each cell that briefly explain the content that follows.

<div style="overflow-x:auto;">
<table>
    <tr>
        <!-- Link Cities: Skylines -->
        
        <th><a href="https://en.number13.de/tag/cities-skylines/">Cities Skylines</a></th>
        
        <!-- Link RimWorld -->
        
        <th><a href="https://en.number13.de/tag/rimworld/">RimWorld</a></th>
 
    </tr>
    <tr>
        <!-- Screenshot Cities: Skylines -->
        
        <td><img src="https://number13.de/content/images/2019/03/Cities_Skylines.jpg" width="400" height="80"></td>
        
        <!-- Screenshot RimWorld -->
        
        <td><img src="https://www.number13.de/content/images/2019/03/RimWorld.jpg"  width="400" height="80"></td>
    <tr>
</table>
</div>

With comments, it's easy to create new categories of games without going through the code for ages.