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>.

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

Attributes:
Attribute Definition
align

Specifies the alignment of the content inside a div element.
Possible Values:

  • left
  • right
  • center
  • justify

-Deprecated-

Global Attributes:

The <div> tag also supports the Global Attributes in HTML5

Event Attributes:

The <div> tag also supports the Event Attributes in HTML5



Last updated on 2 August 2018 By Rene Spronk

View All HTML Tags

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.