WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

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

<div> A tag defines a separate block or area section in an HTML document.

<div> Tags are often used to combine block-level elements so that they can be formatted with CSS.


Browser Support

Element
<div> Yes Yes Yes Yes Yes Yes

Tips and Notes

prompt´╝Ü<div> Elements are often used with CSS to layout web pages.

Note: By default, browsers usually <div> Place a line break before and after the element. However, you can change this by using 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