copyright © CSSPG, lud February 28 1999


 for practical use of CSS

ALIGN Examples

this document is located at...
<URI:http://css.nu/examples/align.html>

* FLOAT *

This shows use of the <ALIGN="left">

The CSS way: Float (left | right | none)

The CSS "float" property applies to all elements, and is not inherited. It is especially useful for inline IMG elements, which are treated as block elements when the float property is applied to them.

In Netscape4x, float is not properly implemented, so the following examples may not render correctly for Netscape users.

Floated left...

With float none... stays inline...

And float right wafts the image to the right.

* TEXT-ALIGN *

The CSS way: text-align (left | right | center | justify)

The CSS "text-align" property applies to block level elements, and is inherited. This example markup shows use of the <...ALIGN> attribute, applied to various HTML elements.

<CAPTION ALIGN="left">
<TABLE ALIGN="center">
<H1 ALIGN="right">

The CSS equivalent might be to include a ruleset for alignment in the external CSS, if the element will be re-used, or if the style is expected to be site-wide. Alternatively, the style could be embedded in the <HEAD>... </HEAD> section of a specific document, or inline, as in the example below.

	<H1 STYLE="text-align: center">Centered Header</H1>	
		

Centered Header

The elements which may be aligned include:


CSS Pointers Navigation
Index · Browser Bugs · Books · Tools · DHTML · XSL & DSSSL
Main Site Navigation
Index · Articles · Examples · Experiments · FAQ · Markup · Styles · Who is?
CSSPG ~ Sue ~ Roland
Validate markup Check CSS