To specify document division. The ALIGN attribute allows different alignments (left, center, right) to be used in different parts of the document.
The DIV element can also be used in conjunction with style sheets in order to affect the rendering of parts of a document in various ways.
The part of document is aligned according to the ALIGN attribute of the element.
attribute name | possible values | meaning | notes |
---|---|---|---|
ALIGN | LEFT, CENTER, RIGHT | alignment of text within the element | deprecated in HTML 4.0 |
The ALIGN attribute specifies the default alignment; it can be overridden by ALIGN attributes in enclosed elements (e.g. P elements).
<P> This is a normal paragraph which will be rendered according to default alignments, which usually means left alignment. </P> <DIV ALIGN=CENTER> <P> This is text which will be centered. </P> <P> This is a longer text paragraph which will be centered. It is so long that line breaks will most probably occur. Notice that the division into lines is usually not the same as in the HTML file. </P> </DIV>The following example shows how to present (poetic) text as centered and with a particular division into lines:
<DIV ALIGN=CENTER> Mieleni minun tekevi<BR> aivoni ajattelevi<BR> lähteäni laulamahan<BR> saa'ani sanelemahan.<BR> <P ALIGN=RIGHT><CITE>Kalevala</CITE></P> </DIV>
In HTML 4.0, the ALIGN attribute is deprecated .
Since DIV is a block-like element, it terminates an open P element ( i.e. causes the browser to assume an implied </P> tag when necessary). Other than this, browsers are not expected to render paragraph breaks before and after DIV elements. If paragraph breaks are desired, you can use the P element with an ALIGN attribute instead.