HTML Elements
Next ❯Basic Tags
- Elements defined by a Start Tag and if it contains any content then it has to be end with an End Tag
- Start tag also called as Opening tag
- End tag also called as Closing tag
Example:
<div>
This is division content</div>
<h1>
This is heading content</h1>
<p>
This is paragraph content</p>
- All the above examples are the HTML Elements
- Note! Elements with no contents are called empty or void elements,and they have only start tag (like
<img>,<br>,<hr>
)
Nested Elements
It means an HTML element inside another HTML element (elements can contain elements).<First_Tag_Name>
...First Tag Content...
<Second_Tag_Name>
...Second Tag Content...</Second_Tag_Name>
</First_Tag_Name>
Example:
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>My First <i>italic</i> Heading</h1>
<p>My First paragraph.</p>
</body>
</html>
- trending_downAbove Example Explained
<html>
contains<head>,<title>
<body>,<h1>,<i>,<p>
elements<head>
contains<head>,<title>
element<body>
contains<h1>,<i>,<p>
element<h1>
contains<i>
element<i>
and<p>
contains no element
- Note! Don't forget the End Tag when you writing the script, it might produce wrong result/output.
❮ Prev Introduction
Next ❯Basic Tags