HTML <div> Tag: The HTML<div> tag specifies a division in an HTML document. This HTML div tag is often used as a container for other HTML elements to style them with CSS or with JavaScript to perform certain tasks. And also it is used to group element for styling purpose.
HTML <div> Tag
This HTML<div> tag supports both the global and the event attributes.
Syntax: <div> Text </div>
The Div is the most usable tag in web development because it helps us to separate out data in the web page and we can create a particular section for particular data or functionality in the web pages.
- The div tag is Block level tag
- It is a generic container tag
- It is used to the group of various tags of HTML so that sections can be created and style can be Applied on them.
Example:
<!DOCTYPE html> <html> <body> <div style="background-color:lightblue"> <h3>tutorials.freshersnow.com</h3> <p>Learn all courses at any time, with lifetime access</p> </div> </body> </html>
Output:
Attributes that are supported by the <div> tag
Attribute | Value | Description |
---|---|---|
align | left right center justify |
Describes the alignment of the content inside an element |