Tags

Tags are keywords surrounded by angle brackets.

 

Syntax:

<tagName>

 

Usually consisting of opening and closing tag pairs, whereby the closing tag is preceded with a forward slash, like so:

 

<p>Hello, World!</p>

 

Some tags do not have the closing variant, and sometimes are seen to include a closing forward slash, like so:

 

<img src="myImage.png" />

 

Tags also often include attributes within the opening tag to provide more information or instructions that are interpreted by the browser, such as the src attribute above which is then assigned an image file name to define that specific image tag. Similarly tags can be given an id or a class name or some inline styling, or any and all of the above, like so:

 

<h1 id="myID" class="frontHeading" style="color:#FF00FF">Hello, World!</h1>

Leave a Reply