HTML Elements
HTML elements are building blocks of web pages, consisting of an opening tag, content, and a closing tag.The HTML element is everything from the start tag to the end tag.
Syntax:
<tag_name>This is my content</tag_name>
Examples of some HTML Elements are below:
Heading tag
<h1>My First HTML heading.</h1>
Output:
Paragraph tag
<p>My First HTML paragraph.</p>
Output:
Note: Some HTML elements have no content.These elements are called empty elements, like <br> and <hr>.
Nested HTML Elements:
- Yes HTML elements can be nested.(This means one elements can be in side another element).
- All HTML documents consist of nested HTML elements.
The following example shows Nested HTML elements.(<html>
, <body>
, <h1>
and <p>
),
<!DOCTYPE html>
<html>
<body>
<h1>This is Heading</h1>
<p>This is paragraph.</p>
</body>
</html>
Output :