Re: [CSS21] [css3-text] [css3-tables] text-indent percentages

On Tue, Sep 14, 2010 at 1:20 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> The CSS2.1 spec says that text-indent percentages are relative to the
> containing
> block width, not the block element's width. I guess the goal was to allow
> use of
> margins + negative text indent for hanging indents, but this has some
> rather...
> odd implications for inline blocks and table cells.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
> <title>Blank page</title>
> <style>
>  body {
>    border: dotted thin silver;
>  }
>  table {
>    border-spacing: 0;
>  }
>  .test {  width: 100px; text-indent: 50%; border: solid thin gray}
> </style>
> <table>
>  <tr> <td class="test">T
> </table>
> <p><span class="test" style="display: inline-block">T</span>

I'll note that Opera is the only browser that actually pays attention
to that line for table-cells.  Everyone else gives the <td> a
text-indent of 50px.  Same with padding.  Perhaps everyone else treats
table cells as containing blocks for their content?


> Given that padding behaves the same way, though, perhaps it's best to define
> the containing block of a table cell by splitting the table cell into two
> boxes at the padding edge and having the outer one be the containing block
> for the inner one.

Something in this direction is necessary.  No comment about the
specific fix you're suggesting, but when we have webkit/gecko/ie all
agreeing on a rendering, we should probably be fixing CSS to match it.


> And I'm wondering whether CSS3, which has explicit support for hanging
> indents, should allow for using percentages of the element's width rather
> than that of its containing block.

Yeah, we should.

~TJ

Received on Tuesday, 14 September 2010 21:00:18 UTC