W3C home > Mailing lists > Public > www-style@w3.org > September 2010

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Tue, 14 Sep 2010 13:20:16 -0700
Message-ID: <4C8FD900.4090500@inkedblade.net>
To: "www-style@w3.org" <www-style@w3.org>
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
Received on Tuesday, 14 September 2010 20:20:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:31 GMT