Table of contents
HTML Elements
- The HTML elements have a starting tag --> content --> ending tag.
Example of some HTML Elements:
<h1>This is first heading</h1>
<p>This is first paragraph</p>
Starting Tag | Element content | Ending Tag |
<h1> | This is the first heading | </h1> |
<p> | This is the first paragraph | </p> |
<br> | none | none |
Note: In HTML, some elements do not have an ending tag, such as
<br>
,<img>
, and more.
Nested HTML Elements
- HTML elements are also known as nested elements, which means elements contain other elements. All HTML elements consist of nested elements such as
<html>
,<head>
,<body>
,<h1>
, and<p>
.
Example:-
<!DOCTYPE html>
<html>
<head>
<body>
<h1> --- </h1>
<p> --- </p>
</body>
</head>
</html>
Example:-
<html>
is the root element that defines the whole HTML document and it has a starting tag<html>
and an ending tag</html>
. Inside this<html>
element is the<body>
element.
<html>
<body>
* * * * * * * *
</body>
</html>
<body>
element defines the document body and it has a starting tag<body>
and an ending tag</body>
. Inside this<body>
tag, there are 2 more elements like<h1>
and<p>
.
<body>
<h1> --- </h1>
<p> --- </p>
</body>
<h1>
element defines the heading and it has a starting tag<h1>
and an ending tag</h1>
. It ranges from<h1>
to<h6>
.
<h1> --- </h1>
<p>
element is the paragraph and it has a starting tag<p>
and an ending tag</p>
.
<p> -- </p>
Empty HTML Elements
- HTML elements with no content are called empty elements. For example, the
<br>
break element is an empty element. It has a starting tag<br>
but no ending tag.
<p>This is awsome<br>and called line break.</p>
Happy Learning
Thanks For Reading! :)
-SriParthu๐๐ฅ
ย