HTML Elements

An element usually consists of an opening tag, closing tag and the content between them.

<opening_tag> Here content is present </closing_tag>
<p> Here content is present </p>

Types of elements

1. Element (opening-closing tags)

The opening tag consists of less than sign(<), tag name and greater than sign(>). For example, (<p>).

The closing tag consists of less than sign(<), forward slash(/), tag name and greater than sign(>). For example, (</p>).

Example

<h1>This is the most important Heading.</h1>
<p>This is a paragraph for test.</p>
Try </>

2. Element (self-closing tag)

The self-closing tag consists of less than sign (<), element-name, greater than sign with an optional forward slash (/>). For example, (<br/>).

Example

<br /> element has space between 'br' and forward slash (/).
<br/> element has not space between 'br' and forward slash(/).
<br> has not forward slash(/).
Try </>
  • You may add or remove forward slash(/) in the self-closing tag. That does not matter.

  • You may have space between the element name and forward slash.For example, both <br /> and <br/> are correct.

  • It is the list of self-closing tag. p, area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, wbr.

Case Sensitivity:

Here a question arises that whether can we have the element name in uppercase or mixed form?

The answer is simple. You can have the element name in lowercase, uppercase or mixed form.

Example

<code>This is in lowercase form.</code>
<CODE>This is in uppercase form.</CODE>
<coDe>This is in mixed form.</coDe>
Try </>

This example proves that any of the cases or mixed form may be used for the element name. The element name is case-insensitive.



Was this article helpful?

 

Email:

Message: