HTML Elements

An HTML element is defined by a starting tag and closing tag. If element contain some other content, then it will end with closing tag. You can show some example as below.

Start Tag

Content

End Tag

<p>

This is paragraph content.

</p>

<h1>

This is heading content.

</h1>

<div>

This is division content.

</div>

<br />

 

 

 

So here <p>, <h1>, <div> is an HTML element. But here some other HTML elements which don't need to be closed, like as <img />, <hr />, <br /> elements. These are known as void elements.

HTML Tag vs. Element

An HTML element is defined by starting tag. But if the element contains some content then it is closing with closing tag.

For example, <p> is starting tag of the paragraph and </p> is closing tag of the paragraph, but <p>This is paragraph</p> is a paragraph element.

Nested HTML Elements

If the one HTML element inside another HTML element, then it's called Nested HTML elements. You can see example code as below

<!DOCTYPE html>
<html>

   <head>
      <title>Nested Elements Example</title>
   </head>

   <body>
      <h1>This is <i>italic</i> heading example</h1>
      <p>This is <u>underlined</u> paragraph example</p>
   </body>

</html>

You can see above example code output as below