HTML <div> Tag
Description:
The HTML <div> tag is used for defining a section of your document. With the <div> tag, you can group large sections of HTML elements together and format them with CSS. For example, you could have your navigation section wrapped in one <div> and your main content section in another <div>.
Specific Attributes:
None
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| align | Specifies the alignment of the content inside a
div element.
-Deprecated- |
Example Code:
<div style="background-color:orange;text-align:center">
<p>Navigation section</p>
</div>
<div style="border:1px solid black">
<p>Content section</p>
</div>
Result
Navigation section
Content section