HTML Tag vs. Element

 

HTML Tag vs. Element


An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag.


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


Nested HTML Elements

It is very much allowed to keep one HTML element inside another HTML element −


Example

Live Demo

<!DOCTYPE html>

<html>


   <head>

      <title>Nested Elements Example</title>

   </head>

   <body>

      <h1>This is <i>italic</i> heading</h1>

      <p>This is <u>underlined</u> paragraph</p>

   </body>

</html>

This will display the following result −

No comments:

Post a Comment

Pages