Created attachment 42715 [details] Reveals a rendering bug in webkit. Absolutely position, inline elements should remain centered until left or right properties are set. Whenever an an inline element's position property is set to absolute and the left, right, top and bottom properties are left to their defaults(auto), and the parent element has text-align property set to center, the element does not keep it's position. CSS: #element { position: absolute; } #parent { text-align: center; width: 500px; height: 300px; } HTML: <div id="parent"> <span id="element">Test</span> </div> The span should remain centered within it's parent until the left or right properties are explicitly set. However, if we add an inline element or text before the span: <div id="parent"> Text or or <span>some other inline element</span><span id="element">Test</span> </div> The element centers along with the elements/text before it. I've attached an example that shows the unexpected behavior that occurs if the position property was set to absolute via javascript.
I can also confirm this bug in latest WebKit nightly build (r59821)
The bug is still alive in Chrome 8.0 build , is there any work around other than adding a text or to make it work.
I haven't confirmed the test case against the patch there but I think this is related to 4860.
The most minimal testcase I can make is: <!DOCTYPE html> <style> body { text-align: center; } span { position: absolute; } </style> <span>Test
I don't think there's anything to fix here anymore. Would you mind confirming?
I am unable to reproduce this bug in Safari 16.6 using attached test case and one from Comment 04 and it matches Chrome Canary 117.