HTML <div> Tag
In this tutorial, we will learn about div tag in HTML with the help of examples.
<div> Tag
Div tag <div> is used for defining a section of your document.
The <div> tag is usually used to group large section of body tag for easy styling and formating with CSS.
Note : It doesn't render anything special in the browser.
By default browser put a line break before and after the <div> tag.
Syntax
<div>.....</div>
Example
<!DOCTYPE html>
<html>
<head>
<title>Div Tag</title>
</head>
<body>
<div>
<p>This is the paragraph between the division tag.</p>
</div>
</body>
</html>
Output
This is the paragraph between the division tag.
Specific Attribute
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | Automatically let the browser to focus |
Global Attribute
Div Tag support all the global attributes of HTML.
Event Attribute
Div Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of div tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML dl
Tag.