changed CSS behavior in NS6, IE5
Peter C. Gorman
pgorman at library.wisc.edu
Fri Apr 7 12:22:48 EDT 2000
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."
Taking this literally, it suggests that if a div contains a table,
the table itself should be centered (and possibly also the text
within its cells?). So, I do the following:
<head>
<title>Untitled</title>
<style type="text/css">
<!--
.foo { text-align: center }
-->
</style>
</head>
<body>
<div class="foo">
<table>
<tr><td>some words</td></tr>
<tr><td>some more words</td></tr>
</table>
</div>
</body>
Here's what happens:
Netscape 4.72 Mac/NT, IE5 NT: table is centered, text is left-aligned
Netscape 6 Mac/NT: table is left-aligned, text is left-aligned
IE 4.5 Mac: table is centered, text is centered
IE 5.0: table is left-aligned, text is left-aligned
If I add a style td { text-align: left }, IE 4.5 behaves like
Netscape 4.72 (the effect I want). My question is which browsers are
interpreting this page correctly? If the answer is Netscape 6/IE 5,
then my question becomes: how do I align a block element in the
center of a page, but have text within it left-aligned? (I know I can
use <div align="center">, but I want to stick with CSS).
Thanks,
--
_______________________________
Peter C. Gorman
Senior Technology Librarian
University of Wisconsin-Madison
Library Technology Group
pgorman at library.wisc.edu
(608) 265-5291
What's the difference between fiddle players and government bonds?
Government bonds eventually mature and earn money.
More information about the Web4lib
mailing list