Sponsored Ads
The entire html document is created with html elements. An Html elements consist of a starting tag, the content of the tag and the closing tag. i.e. The content of the tag is always in between the starting and the closing tag.
Sponsored Ads
But there won’t be any content and closing tag if the element is an empty element or void element.
Example
<p>This is a paragraph</p>
<h1>This is a Main heading content</h1>
<br />
<hr />
So in the above example the first two are normal html elements and the last two are void elements. In the first example the
<p> = starting tag
This is a paragraph = Element contents
</p> = closing Tag
Html Tags vs Html Elements
An Html element will always contain an Html tag. If the Html element contain other contents then after the content it ends with a closing tag.
Sponsored Ads
If it is a void element then the html tag itself is the html element. Otherwise the Html element contain the starting tag, the contents and the closing tag.
Nested Html Elements
An Html elements can contain other html elements i.e. the html elements can be nested.
Sponsored Ads
Example
<!DOCTYPE html>
<html>
<head>
<title>Nested Elements Example</title>
</head>
<body>
<div>
<h1>This is heading</h1>
<p>This is <b>bold</b> paragraph</p>
<p>This is <u>underlined</u> paragraph</p>
</div>
</body>
</html>
Sponsored Ads