Re: align=center

Frank Boumphrey wrote:
> 
> There seems to be no way in CSS to align an object in the center of the
> page, such as the align=center attribute in HTML.
> 
>  Position properties aligns the left edge of an image, text-align will align
> a table in IE4 but not an image (I don't think though that this is what the
> specification intended, I think text align is only ment to refer to text).

The image is an inline element. It needs to be inline inside some block
element.
One of the well-known problems of using <p> as a paragraph separator,
which some folks still try to do, is that you end up with text which
looks like a paragraph but the stylesheet is unable to select it:

<!doctype html system "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>test</title>
<style type="text/css">P { color: red }</style></head>
<body lang=>
This text is not inside a paragraph. It will probably not be red
<p>
This text <em>is</em> inside a paragraph, and will be red
<!-- closing p tag omitted, which is valid HTML -->
</body></html>

> Am I missing something? Is this an oversight? or is this intended?

The only thing that you are missing is to put your inline images inside
a container, such as P.

P.figure {text-align: center }

<P class="figure"><IMG src="url" alt="stuff"></P>

--
Chris

Received on Friday, 24 April 1998 17:00:36 UTC