HTML <div> tag
The <div> tag helps to create the layout of the Web Page by dividing an area into sections or divisions.
This tag is one of the most important tag to group other tags. So it acts as a container for other tags.
You can apply CSS to style this element.
Syntax:
<div>Can Include Multiple tags</div>
Example
<div style ="background-color:black;color:LightGreen;"> <ul> <h4>Month Jan-Apr</h4> <li>January</li> <li>February</li> <li>March</li> <li>April</li> </ul> </div> <div style ="background-color:black;color:LightGreen;"> <ul> <h4>Month May-Aug</h4> <li>May</li> <li>June</li> <li>July</li> <li>August</li> </ul> </div> <div style ="background-color:black;color:LightGreen;"> <ul> <h4>Month Sep-Dec</h4> <li>September</li> <li>October</li> <li>November</li> <li>December</li> </ul> </div>
CSS Default Value
display: block;
How Browser will display
BLOCK Level.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
No difference | No difference | In HTML5, the <align> attribute is deprecated when it is used with the <div> tag. |
Attributes used with <div> tag
Attribute | Description |
---|---|
width | Sets the width of the div. |
height | Sets the height of the div. |
align | To align the content inside the <div>. (HTML5 does not support this attribute when it is used with the <div> tag). |
Global Attributes
The <div> tag supports Global attributes.
Event Attributes
The <div> tag supports Event attributes.
Supporting Browsers
Related Tags
<section> , <span> , <header> , <footer> , <article> , <summary> & <nav> tags