[csswg-drafts] [css-text-3] percentage on text-indent

frivoal has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text-3] percentage on text-indent ==
We've discussed this previously, but did not conclude. Old thread starts here:
https://lists.w3.org/Archives/Public/www-style/2015Feb/0250.html

CSS2.1 and CSS-TEXT-3 seem to agree that text-ident applies to block level elements, and that percentages are resolved against the width of containing block, i.e. the parent.

Firefox violates that, and they resolve the percentage against the content area of the element itself.

Even though this seems like a spec violation, it seems to be nicer behavior, as discussed for example in this email: https://lists.w3.org/Archives/Public/www-style/2015Feb/0273.html

>  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.

Also, here's another mail where @fantasai argues that refering to the containing block has some odd consequences in tables.
https://lists.w3.org/Archives/Public/www-style/2010Sep/0431.html

Since both behaviors (+ bug based variations) are attested in browsers, we're probably not overly constrained by web compat. Going by the width of the content area of the element makes more sense to me (and to everyone who participated in the previous email threads AFAICT) so I suggest we switch to that.  

Most typically, text-indents are specified in lengths, not in percentages, so maybe we shouldn't overthink this, but we should get consistency anyway.

----

Note: In discussions of this topic, the question of interaction between percentage text-indents and intrinsic sizing is also occasionally raised, but it is present regardless of the solution we pick, so I think these can remain independent, and there's another issue for that: https://github.com/w3c/csswg-drafts/issues/1597

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2394 using your GitHub account

Received on Monday, 5 March 2018 07:36:31 UTC