Bruce's Web Lab

Alignment



Alignment Methods

Paragraph Alignment

Paragraphs may be justified using the ALIGN attribute to the <P> tag, with the values RIGHT, LEFT, or CENTER. If no alignment is given, the paragraph will justify on the left margin.

THIS ONLY WORKS ON SOME BROWSERS

<P ALIGN=RIGHT>

This paragraph should be justified on the right margin. Test with different browsers to see if they interpret it differently. Also, try changing the width of the browser window to see what happens.

<P ALIGN=LEFT>

This paragraph should be justified on the left margin. Test with different browsers to see if they interpret it differently. Also, try changing the width of the browser window to see what happens.

<P ALIGN=CENTER>

This paragraph should be centered between the margins. Test with different browsers to see if they interpret it differently. Also, try changing the width of the browser window to see what happens.

Section Alignment

Sections -- groups of paragraphs and other block elements -- may be aligned using the <DIV> tag, with the values RIGHT, LEFT, or CENTER. If no alignment is given, the section will justify on the left margin.

THIS ONLY WORKS ON SOME BROWSERS

<DIV ALIGN=RIGHT>

This is a paragraph.

This is another paragraph, believe it or not!

This little paragraph went to market.

This little paragraph has its own alignment tag (<P ALIGN=LEFT>), which overrides the alignment of the <DIV> element that contains it.

This little paragraph went home.

<DIV ALIGN=CENTER>

This is a paragraph.

This is another paragraph, believe it or not!

This little paragraph went to market.

This little paragraph has its own alignment tag (<P ALIGN=LEFT>), which overrides the alignment of the <DIV> element that contains it.

This little paragraph went home.


[Return to Weblab] [Ask Bruce]