About Element

HTML Elements


HTML elements are also known as HTML tags. HTML tags are always written under < > brackets to display and understand the web browser correctly.  Tags in HTML are two types:
  1. Container Tag: Such tag has starting and ending tag and some container comes between these tags. For example tag for paragraph is represented as <p> that is a container tag having ending tag </p>. An ending tag must contain backslash ( / ). When ending is applied effect of that tag end at that place. Some of the container tags in HTML are: <p></p>, <h1></h1>, <h2></h2>, <h3></h3>, <h4></h4>, <h5></h5>, <h6></h6>, <div></div>, <b></b>, <u></u> and many more....
  2. Empty Tag: An empty tag has no any separate ending tag OR it ends within the same tag. For example tag for image is <img> and is empty tag that does not contains content between two points. It can be denoted as <img> OR <img />. Some of the empty tags are: <img>, <br>, <input> etc.

We will use container and empty tag in example given below:

<!DOCTYPE html>
<html>
<body>

<p>This is a container tag  containing starting and closing tag. Effect of paragraph is ending here.</p>

Image tag given below is an empty tag. <br>

<img src="https://myragroup.in/education/assets/images/default/dis.png" height="150">


</body>
</html>

This is a container tag containing starting and closing tag. Effect of paragraph is ending here.

Image tag given below is an empty tag.


How to use container tag ?


A container tag must be closed else its effect will not end that can disturb the effect of other tags.
<!DOCTYPE html>
<html>
<body>

<p>This is correct way of writing container tag.</p>

<p>This is wrong way of writing container tag.

</body>
</html>

This is correct way of writing container tag.

This is wrong way of writing container tag.