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>
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.
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.
Comments?
~fantasai