HTML element is the collection of start and end tag with the content inserted in between them.
Syntax:
<tagname > Contents... </tagname>
Example:
<!-- HTML code to illustrate HTML elements --><!DOCTYPE html> <html> <head> <title>HTML Elements</title> </head> <body> <p>Welcome to GeeksforGeeks!</p> </body> </html> |
Output:
Welcome to GeeksforGeeks!
Nested HTML Elements: The HTML element is use inside the another HTML Element is called nested HTML elements.
Example:
<!DOCTYPE html> <html> <head> <title>HTML Elements</title> </head> <body style = "text-align:center"> <h1>GeeksforGeeks</h1> <p>Computer science portal</p> </body> </html> |
Output:

Explanation: In the above example, <html> tag contains the <head> and <body>. The <head< and <body> tag contains another elements so it is called nested element.
Necessary to add end tag: It is necessary to add end tag of element. Otherwise the displayed content may not be display correctly.
Example:
<!DOCTYPE html> <html> <head> <title>HTML Elements</title> </head> <body> <!-- h1 tag does not contains end tag --> <h1>GeeksforGeeks <!-- p tag does not contains end tag --> <p>Computer science portal </body> </html> |
Example:




