X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <div> Tag


Example

A section in a document that will be displayed in blue:

<div style="color:#0000FF">
  <h3>This is a heading</h3>
  <p>This is a paragraph.</p>
</div>

Try it Yourself »

Definition and Usage

The <div> tag defines a division or a section in an HTML document.

The <div> tag is used to group block-elements to format them with CSS.


Browser Support

Element
<div> Yes Yes Yes Yes Yes


Tips and Notes

Tip: The <div> element is very often used together with CSS, to layout a web page.

Note: By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.


Differences Between HTML 4.01 and HTML5

The align attribute not supported in HTML5.


Attributes

Attribute Value Description
align left
right
center
justify
Not supported in HTML5.
Specifies the alignment of the content inside a <div> element


Global Attributes

The <div> tag also supports the Global Attributes in HTML.


Event Attributes

The <div> tag also supports the Event Attributes in HTML.


Related Pages

HTML tutorial: HTML Layout

HTML DOM reference: Div object



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook