Bug 64686 - Margin: 0 auto; and Background-position: center; don't align.
Summary: Margin: 0 auto; and Background-position: center; don't align.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Nobody
URL: http://ianstormtaylor.com/experiments...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-18 03:40 PDT by Ian Storm Taylor
Modified: 2022-07-12 14:59 PDT (History)
3 users (show)

See Also:


Attachments
A case study of the bug. (58 bytes, text/plain)
2011-07-18 03:40 PDT, Ian Storm Taylor
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Storm Taylor 2011-07-18 03:40:31 PDT
Created attachment 101143 [details]
A case study of the bug.

When you have something centered via `margin: 0 auto;` and something centered via `background-position: center ...;` the two objects don't line up when the window is an odd number of pixels wide.

The case study makes it really obvious if you resize the page.


Currently working in all other browsers including IE 8.0
Comment 1 Alexey Proskuryakov 2011-07-18 10:27:41 PDT
Comment on attachment 101143 [details]
A case study of the bug.

Obsoleting an attachment that contains nothing but a test case URL.

Would you be willing to attach a reduced test case? The current test case contains a ton of external dependencies.
Comment 2 Ian Storm Taylor 2011-07-18 10:36:02 PDT
(In reply to comment #1)
> (From update of attachment 101143 [details])
> Obsoleting an attachment that contains nothing but a test case URL.
> 
> Would you be willing to attach a reduced test case? The current test case contains a ton of external dependencies.

Yup sorry about that. Forgot about all those dependencies in my blank template.

The test case has been updated to be super light.
Comment 3 Nicholas Shanks 2011-10-06 03:55:55 PDT
Test case URL fails when viewport width is an odd number of pixels wide, passes when viewport is an even number of pixels wide.
Comment 4 evanbor95 2017-07-11 06:23:38 PDT
Same on the iOS - auto-margin don't center element without setting sizes
Comment 5 Brent Fulgham 2022-07-12 14:59:53 PDT
The test site no longer exists. We can't take further action on this bug.