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

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