![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
This element is a general container for a part of the contents of a page. Through the DIV element you can add attributes, like style information, to this whole division. The DIV element will not show anything when used without any other attribute.
A division will terminate a paragraph opened with the P element.
<DIV align="center"> is the same as the deprecated <CENTER> element.
The difference between this element and the SPAN element is that the span element works inline, and the div element creates block-level content. With block-level content, most browsers surround the block by whitespace, starting at a new line.
<!ELEMENT DIV - - (%flow;)* -- generic language/style container --> <!ATTLIST DIV %attrs; -- %coreattrs, %i18n, %events -- >from the HTML 4.0 DTD, "Copyright © World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved."
Core attributes:
class
id
style
title
Internationalization attributes:
dir
lang
Events:
onclick
ondblclick
onmousedown
onmouseup
onmouseover
onmousemove
onmouseout
onkeypress
onkeydown
onkeyup
![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() |
Value | Description |
---|---|
CENTER | Centers the contents between the margins of the division. |
JUSTIFY |
This value will space the contents of the division evenly between the two
margins of the division.
This value is not supported by the HTML 3.2 and Netscape Navigator 3.0. |
LEFT | Places the contents to the left side of the divison. This is the default alignment when the text direction is left to right. |
RIGHT |
Places the contents to the right side of the divison. This is the default
alignment when the text direction is left to right. |
Netscape Navigator 4.0 has problems displaying the last line of a division when the division has a fixed width, set with a style sheet (see the examples).
![]() |
<DIV align="right">
|
![]() |
This text is completely right-aligned which means that every line
aligns to the right side of the page. ![]() |
![]() |
<DIV align="center" style="width: 200px;">
|
![]() |
align="center"
Hello there, this is just some text to see how the alignment of text inside a division looks like. It's not a very interesting text, but I just had to have some text to create the example. |
![]() |
<DIV align="justify" style="width: 200px;">
|
![]() |
align="justify"
Hello there, this is just some text to see how the alignment of text inside a division looks like. It's not a very interesting text, but I just had to have some text to create the example. |
![]() |
<DIV align="left" style="width: 200px;">
|
![]() |
align="left"
Hello there, this is just some text to see how the alignment of text inside a division looks like. It's not a very interesting text, but I just had to have some text to create the example. |
![]() |
<DIV align="right" style="width: 200px;">
|
![]() |
align="right"
Hello there, this is just some text to see how the alignment of text inside a division looks like. It's not a very interesting text, but I just had to have some text to create the example. |