HTML Elements is the combination of HTML tags and content. The html element is between end tag from start tag, it called the html element, it is important to have your content in it, otherwise it will be called only and only the tag.
<!DOCTYPE html> <html> <body> <title>Tutorials Track</title> <title></title> </body> </html>
Here is the html elements in the first line, because here we have put our content in the middle of the opening tag and the closing tag, while in the second line it is only the tag, because there is no content of any kind here.
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> </body> </html>
Nested HTML Elements
Other HTML tags can be written in the middle of an HTML tag. This process called Nested to HTML Elements. HTML starts with , and closes . And many tags come between them, which you keep holding content in yourself. Due to which it nested.
The order in which HTML Element is open. They are close in the opposite order. This means that the first element is the closest closure. like; In the above example, we have opened the first HTML Element, Body Element, Heading Element, and Paragraph Element respectively. But, the first thing is to have Heading Element closed. After that, the paragraph closed. Next, the Body and HTML Element closed down respectively.
<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
Empty HTML Element
Some HTML tags do not have a companion tag, ie Closing Tag. They are just Opening Part or Start Tag. In these tags, No content written. Such HTML Element called Empty Element.
In Empty HTML Elements, both parts of a tag i.e. the Opening Part and Closing Part are include in the same tag. like; hr is an Empty Element. Which is use to write a horizontal line at the end of the document. This tag is write in a proper way – <br/>
First of all, this tag is also open like Opening Tag. Then Forward Slash is give giving a space to close this tag. In this way, both parts are write in the same tag. And HTML Standard is also not violate. It is write solely by the rule.