Re: [CSS2.1] Position of absolute position box in relative box with text-align center

On Mon, Sep 15, 2014 at 4:45 PM, Greg Whitworth <gwhit@microsoft.com> wrote:
> Hello all, I have the great pleasure of bringing another 2.1 interop issue to the list for discussion very close to the last one regarding placement of absolute positioned boxes [1]. This one is interesting as Chrome and FF place the box all the way to the left of the viewport while IE places it at the center. Based on the 2.1 spec [3], I believe that IE is doing the correct thing in this case. Here is a fiddle of the interop issue: http://jsfiddle.net/9wsegz9s/ and here is the markup with style inline for discussion:
>
> <body style="text-align: center;">
>         <div style="display: inline; position: relative;">
>                  <div id="parent" style="display: block; position: static;">
>                                 <div id="child" style=" display: block; padding: 5em; background-color: green; position: absolute; ></div>
>                 </div>
>         </div>
> </body>
>
> Since the wrapper box should be positioned at the center of the viewport due to text-align[2] the next inline box should be starting its positioning there as well. Thoughts?

Hm, why do you think it should be centered? The abspos is explicitly
display:block, which would mean (if you ignore the abspos part) that
it's positioned at the start edge of #parent, not the center.

~TJ

Received on Tuesday, 16 September 2014 01:43:03 UTC