HTML | Elements
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:

Recommended Posts:
- HTML | Computer Code Elements
- HTML | Block and Inline Elements
- How to determine the content of HTML elements overflow or not ?
- Hide or show elements in HTML using display property
- Hide or show HTML elements using visibility property in JavaScript
- HTML Course | Structure of an HTML Document
- HTML | DOM HTML Object
- HTML Course | Basics of HTML
- XML | Elements
- CSS | Pseudo Elements
- CSS | Centering Elements
- CSS | Positioning Elements
- ReactJS | Rendering Elements
- PHP | Check if two arrays contain same elements
- jQuery | Add Elements with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



