HTML elements can be nested, where elements can contain other elements. All HTML documents consist of nested HTML elements.
This HTML example contains 4 elements:
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
In the example above, the <body> element is nested inside the <html> element, while both the <h1> and the <p> elements are nested inside the <body> element.
|
1st Element -- The HTML element:
- The <html> element defines the whole document.
- It has a start tag <html> and an end tag </html>.
- This element's content is the <body> element.
2nd Element -- The BODY element:
- The <body> element defines the document body.
- It has a start tag <body> and an end tag </body>.
- This element's contents are both the <h1> and <p> elements.
3rd Element -- The HEADING element:
- The <h1> element defines a heading.
- It has a start tag <h1> and an end tag </h1>.
- This element's content is
My First Heading.
4th Element -- The PARAGRAPH element:
- The <p> element defines a paragraph.
- It has a start tag <p> and an end tag </p>.
- This element's content is
My first paragraph.
|