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

Re: Interaction of text-indent, ::first-letter and float

From: Daniel Schattenkirchner <schattenkirchner.daniel@gmx.de>
Date: Tue, 10 Aug 2010 22:49:39 +0200
Message-ID: <4C61BB63.1020302@gmx.de>
To: www-style@w3.org
Tab Atkins Jr. wrote:
> I don't think I like magic behavior for text-indent on an element
> based on whether a child of the element is floating in a particular
> direction, based on the text-direction of the element.  That seems way
> too confusing, and likely to cause undesired behavior when the floated
> child is something other than ::first-letter, like an image.

I don't speak about floating elements in general. Floating elements can 
inherit and reset the text-indent property. The spec explicitly mentions 
an example including inline-block.

Replaced elements don't seem to be affected by text-indent.

The problem is that ::first-letter isn't required to handle text-indent. 
In fact, only WebKit allows text-indent to be set on ::first-letter.

I think I got it. The solution to the problem should be to explicitly 
allow text-indent to be set on ::first-letter when it's floated. Else it 
doesn't apply anyway.

Some examples with the pseudo element being floated:

If it were allowed (the pseudo would inherit from its parent):
[     T][    his line...]

You could set it to be (text-indent: 0 on the parent element):
[     T][his line...]

If it were forbidden:
[T][    his line...]

But that would be inconsistent when you float normal text:
[    line][    This is...]

which can be made into:
[    line][This is...]

This solution wouldn't make the spec as I originally expected it, but it 
would be the base on which ::first-letter, text-indent and float 
interaction could be implemented more sanely in UAs.

Do we have any implementor opionion available?

> It's always possible to target the element itself when you target its
> ::first-letter, so I recommend just selectively removing the
> text-indent on the element and applying a margin to the
> ::first-letter.

Using above's "solution", I think this is definitely the best method to 
achieve the expected result.

Kind regards, Daniel
Received on Tuesday, 10 August 2010 20:50:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:49 UTC