5 replies [Last post]
7Hz
Offline
newbie
Last seen: 13 years 47 weeks ago
Joined: 2007-08-07
Posts: 8
Points: 0

Hi,

This is my first post in this forum so please forgive any transgressions of etiquette.

I have a div [divA] stretching the full width of the browser window with a background positioned using "background-position: center top;".

Inside divA is another div [divB] set to exactly the same width as the background image in divA and positioned using "margin: 0 auto;".

divB should line up perfectly with the background image of divA.

This works fine in Firefox and IE6 but in IE7 divB is 1px to the left of the background image in divA.

I don't have access to the HTML and can't transfer the background image from divA to divB.

Does anyone have a solution or an explanation for this issue?

Thanks.

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 9 years 41 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Rounding. If you change the

Rounding. If you change the width of your browser you'll probably find widths where they match and widths where they don't. Why are different rounding algorithms used - *shrug*, who knows.

mihirc
mihirc's picture
Offline
Leader
Pune, Maharashtra, India
Last seen: 7 years 47 weeks ago
Pune, Maharashtra, India
Timezone: GMT+5.5
Joined: 2007-05-09
Posts: 728
Points: 204

Hi, i can just guess a

Hi,
i can just guess a solution, did you try giving your divA a overflow:hidden???

Its very early morning here, so plz forgive me if its something that is a 1000 km's from ur question.

mihir Smile

Proprietor - Thoughtfulviewfinder Services
Web Development | Design | Merchandise | Photography
My personal blog: MihirChhatre.com

7Hz
Offline
newbie
Last seen: 13 years 47 weeks ago
Joined: 2007-08-07
Posts: 8
Points: 0

Thanks mihirc, I'm afraid

Thanks mihirc,

I'm afraid that was one of the first things I tried

But thanks for a swift response! :thumbsup:

7Hz
Offline
newbie
Last seen: 13 years 47 weeks ago
Joined: 2007-08-07
Posts: 8
Points: 0

Thanks Chris..S, I think

Thanks Chris..S,

I think you've hit the nail on the head. I tried stretching the window about this morning and it kept popping in and out of alignment.
Luckily, when the browser is the full width of any of the common screen sizes it's aligned properly.

Thanks for a swift response! :thumbsup:

7Hz
Offline
newbie
Last seen: 13 years 47 weeks ago
Joined: 2007-08-07
Posts: 8
Points: 0

And finally - The

And finally - The Solution...

Make sure that the inner div and background image widths are set to an even number.

I think that's probably something that needs to be thought about at the design stage!

Thanks again!