[WEB4LIB] changed CSS behavior in NS6, IE5

Thomas Dowling tdowling at ohiolink.edu
Fri Apr 7 12:57:42 EDT 2000


----- Original Message -----
From: "Peter C. Gorman" <pgorman at library.wisc.edu>
To: "Multiple recipients of list" <web4lib at webjunction.org>
Sent: Friday, April 07, 2000 12:22 PM
Subject: [WEB4LIB] changed CSS behavior in NS6, IE5


> Hello,
>
> Please forgive me if this seems long, but this is bewildering me. I'm
> trying to arrange for a table be aligned in the center of a page, but
> to have text in individual cells left-aligned. Naturally, I want to
> use CSS to do it, but I cannot get Netscape 6 or IE 5 (Mac) to do
> this with CSS1. The CSS1 spec (5.4.6) says, for the 'text-align'
> property:
>
> "Since 'text-align' inherits, all block-level elements inside the
> 'DIV' element with 'CLASS=center' will be centered."

I think the problem is that we're finally starting to see browser that
implement the spec correctly; those of us who learned CSS with the first
round of browser implementations should report for re-education. :-)

The text-align property is more narrowly defined than the HTML align
attribute.  It is supposed to address just the alignment of text within
the specified block-level element.  The alignment of any blocks within the
specified block is not affected.  That has to be controlled through either
margins or absolute placement.

I think what you want is something like:

TABLE.centered {
  margin-left: auto;
  margin-right: auto;
}

TABLE.centered TD {
  text-align: left;
}

/*Prolly necessary for IE and NS4*/
DIV.centerhack {
  text-align: center;
}


Then...

<div class="centerhack">
<table class="centered">
<tr><td>...</td></tr>
</table>
</div>


Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu




More information about the Web4lib mailing list