HTML Elements Explained: Essential Tags and Attributes
Table of Content:
Elements gives structure to a HTML document and tells the browser how you want to present your website. Generally elements consists of a start tag, some content, and an end tag.
Place for main content
Let's look some basic tags-
Start Tag | Element Content | End Tag |
---|---|---|
<p> | Paragraph content. | </p> |
<h1> | Heading content. | </h1> |
So here <p>
Paragraph Content</p>
is an HTML element, <h1>
Heading Content </h1>
is another HTML element.
There are some HTML elements which don't need to be closed, such as
<img>
,
<br>
,
<hr>
elements.
Because of having no elements these are known as void elementsor empty elements.
Nested HTML Elements
HTML allowed to keep one Element inside another Element −
Nested HTML element This is Heading
This is Paragraph.
This is bold text
Live Preview
-
In this example, the
<html>
element defines the whole document with start tag<html>
and end tag</html>
. -
<head>
element defines the head part of the document with start tag<head>
and end tag</head>
. -
<title>
element defines the title of this document with start tag<title>
and end tag</title>
. -
<body>
element defines the document body with start tag<body>
and end tag</body>
. -
<body>
element defines the document body with start tag<body>
and end tag</body>
. -
<h1>
element defines the heading with start tag<h1>
and end tag</h1>
. -
<p>
element defines the paragraph with start tag<p>
and end tag</p>
. <b>
element defines the bold content with start tag<b>
and end tag</b>
.