Re: [CSS21][css-text] percentages on text-indent

On 11/2/15 01:29, fantasai wrote:
> On 02/10/2015 07:37 PM, L. David Baron wrote:
>>  From a side discussion with Greg Whitworth at the face-to-face
>> meeting (triggered by Greg pointing out
>> https://twitter.com/HugoGiraudel/status/565093151904645120 ):
>>
>> Looking at either:
>>    http://dev.w3.org/csswg/css2/text.html#indentation-prop
>>    http://dev.w3.org/csswg/css-text/#text-indent-property
>> it's not clear what percentages on text-indent mean.
>>
>> It says that percentages refer to the width of the containing block:
>> but is that the containing block of the line with the text, or the
>> containing block of the block to which text-indent applies (i.e.,
>> the first block's containing block)?
>
> Well, the 'Applies-to' line says it applies to block containers,
> and a block container's containing block is the containing of the
> block to which text-indent has been applied.
>
>> Apparently browsers disagree on this.  Making the spec's wording
>> more precise seems likely to help.
>
> Spec's wording is precise. Whether it's what we want might be a
> different question.

The behavior required by the spec appears quite counter-intuitive to me.

ISTM that given

   #outer { width: 500px; }
   #inner { width: 200px; text-indent: 10%; }

   <div id="outer">
     <div id="inner">
       Lorem ipsum dolor sit amet...

an author will expect the text to have a first-line indent of 20px, not 
50px.

We also get the surprising result that, assuming <p> doesn't have its 
own text-indent specified, the two lines in

   <div id="outer">
     <div id="inner">
       Line one.
       <p>Line two.

have different indents. Again, I don't think authors would expect this.

A brief test indicates that gecko matches the current spec (modulo a bug 
with dynamic changes that David is just fixing), while webkit uses a 
more intuitive (IMO) [mis]interpretation. Given that browsers currently 
disagree, it seems there's an opportunity to change this without 
breaking the web.

So please, let's change the spec (and gecko) here to match webkit's 
behavior.

If we *don't* change the spec, then I think an example or two 
illustrating this (unexpected) behavior would be a useful addition.

JK

>
> This issue was raised a long time ago, apparently:
>    https://bugzilla.mozilla.org/show_bug.cgi?id=45631#c14
>    https://lists.w3.org/Archives/Member/w3c-css-wg/2004JanMar/0049.html
>
> And the result was no change, apparently?
> Tantek?
>
> ~fantasai
>
>

Received on Wednesday, 11 February 2015 12:08:15 UTC