For text-align:right; in TD, why does "style" work and "class" not?

Posted by Will Fastie on Stack Overflow See other posts from Stack Overflow or by Will Fastie
Published on 2010-05-01T14:31:48Z Indexed on 2010/05/01 14:37 UTC
Read the original article Hit count: 152

Filed under:

If I include this in a table cell:

<td style="text-align: right; font-style: italic; color: maroon;">...

the contents of the cell are aligned as I expect.

If I include the following CSS:

.right-notice { text-align: right; font-style: italic; color: maroon; }

and this cell:

<td class=".right-notice">...

the contents of the cell are not right aligned.

Why is this? What don't I know?

If I change the CSS to replace text-align with float, that works.

Thanks.

© Stack Overflow or respective owner

Related posts about css