Closed Bug 848323 Opened 12 years ago Closed 12 years ago

Absolute positioned, right aligned element looks different in browsers

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: nev.angelova, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0 Build ID: 20130215130331 Steps to reproduce: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style> span {position: absolute; width: 20px; height: 20px; background: #000; color: #fff; font-size: 11px;} div {margin: auto; width: 150px; height: 100px; border: 1px solid #000; text-align: right; position: relative; margin-top: 10px;} </style> </head> <body> <div> <span></span> </div> <div> <span></span>with some text </div> </body> </html> Actual results: The <span></span> element which is absolute positioned without left or right property and text right aligned appears to the right in Firefox and Chrome, in Safari it is to the left. In Opera and IE8 it is to the left with no text after it and to the right with text (see the screenshot). Expected results: I guess that it is not right the element to look different depending on if there is text after it or no. I don't know whether it should be to the left or right.
Per spec, absolute positioning with no offset specified means the "static position" should be used. The spec explicitly leaves what that actually means undefined. We agree with you that whether text is present after the abspos box or not should not affect the behavior, which is why it's always to the right in Gecko. So what's the bug report about, exactly? ;) If it's about Opera and IE8 doing something weird, shouldn't that be reported to those browser vendors?
I'm using absolute positioning with no offset, because the element does not take space and do not affect the surrounding elements in dynamic content. I guess it is not a exactly a bug, just a different way of interpreting it. And I don't know whether there is a right way :)
> I'm using absolute positioning with no offset, because the element does not take space > and do not affect the surrounding elements in dynamic content. That's true of all absolutely positioned elements. The point is, the spec doesn't really define where they go if you don't specify offsets. Marking invalid because this isn't really an actionable bug report, sorry... Again, our behavior seems sane to me, and the bug report says so.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: