"Philipp Lenssen" <in**@outer-court.com> wrote:
I have a site that runs in strict mode in IE6, and IE is making <td>s
for simple two-digit numbers really wide.
As usual, a URL would be essential, since this surely depends on various
ingredients on the page or associated with the page.
So I want to restrict it (and
right-align it) by using <td class="number"> and .number { width: 10px;
}. In Mozilla this works, but IE ignores this.
Why do you set the width in pixels? If it "worked", it could cause serious
trouble.
There's no way to say "two characters wide" in CSS. There's even no
guarantee that all digits have the same width, but this happens to be the
case in all - or at least almost all - fonts. But none of the CSS units
corresponds to the width of a character. The ex unit can be used as a coarse
guess, but for safety, I would use something like width: 2.5ex for a field
that contains two digits.
On the other hand, browsers may ignore anything you say about widths. You
can make most graphic browsers honor your widths for table cells if you set
table-layout: fixed for the table, telling that the browser should apply a
fixed algorithm for allocating the widths, using the _first_ line of the
table as the basis. But then you open a can of worms, especially if you have
used the px unit - content that doesn't fit will (by default) be omitted,
procrustinated.
So I think you should first analyze what causes the problem. Normally a
browser allocates just the needed width for a column. But if you set e.g.
width: 100% for the entire table, then the browser has a problem, and will
probably make it your problem too.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/