Why doesn't text-indent work when its container has a :before/:after pseudo-element? (FX/Opera)
Asked Answered
R

1

11

Ran into this quirk today.

http://jsfiddle.net/UJAjD/3/

You'll notice that in Firefox 7 and Opera, the gray box has the word "Next" in it. The CSS includes a text-indent property that should move that text outside of its container. Viewing this page in IE or Chrome shows it the way it should. At least the way that you would think it should show.

Is this a known bug? Is there a workaround?

Radish answered 5/10, 2011 at 16:25 Comment(2)
The issue doesn't seem to be related to pseudo-elements, this behaves exactly the same: jsfiddle.net/UJAjD/4Steroid
True, so it seems its just as Boris mentioned below. Thanks.Radish
S
11

Per spec, text-indent affects the text in the first line box of the block.

The problem is that the spec doesn't really make it clear whether the first line box in this case contains the block or the text, and different UAs interpret the spec differently...

Seamount answered 5/10, 2011 at 17:50 Comment(1)
Makes sense. Taking this into consideration all I have to do is change :before to :after so that it's no longer the first line. Thank you.Radish

© 2022 - 2024 — McMap. All rights reserved.