Tags And Elements

Tags

A tag is a bit of text that acts as a point demarcation.
To create a tag, HTML gives certain characters special meaning: the angle brackets < and >.

Putting characters within angle brackets creates a tag.

<h1> A heading </h1>

There are two tags:

  • Start tag or opening tag and End tag or closing tag.
  • An end tag always matches a start tag
  • except that it has an extra forward slash after the opening angle bracket.
<h1> A heading </h1>

Type of Tag

  • Container Tag – Which has opening and closing Tag.
  • Ex: -
    <html> ……. </html>
    <head> ……. </head>
    <body> ……. </body>

  • Empty Tag – which has only opening tag.
  • Ex: -
    <br>
    <area>
    <base>
    <hr>
    <img>
    <input>

Element

  • The combination of a start and end tags define an element.
  • Everything between the two tags is referred to as the contents of the element.
  • <h1> A heading </h1>
Cristle Academy

Compiler