IE8 and HTML woes
Author
Discussion

mondeoman

Original Poster:

11,430 posts

298 months

Friday 14th May 2010
quotequote all
Afternoon,

I've been scratching my head all day trying to sort this one out, but its got me beat. I'm working on a website that has a single, fixed background image (not a block colour) so that when you zoom in or out, or if your screen resolution is set differently to 1024, you can see more (or less) of the background image, to the left and right of the main page and it doesn't lose its place wrt the rest of the site height-wise.

Here's the code I used

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="background-image:url(images/Background.png);
background-repeat:no-repeat;
background-attachment:scroll;
background-position:50%0px;
overflow:auto;
position:relative;">
<table height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" width="1024" align="center">
<tr width="100%">
<td>
<img src="images/top-bar.png" style="position:absolute ; top:0px; left:0px; z-index:3 ; width:100% ; height:5px ;">
<img src="images/menu-bar.png" width="100%" height="15px" style="position:absolute ; top:155px; left:0px; z-index:3 ;">
<img src="images/Logo.png" style="position:relative ; top:0px; left:30px; z-index:3 ;">

etc and so on


and it works fine in Chrome, Firefox, Opera but IE8 hates it.

At normal resolution in IE8 the image doesn't fit to the rest of the site, then when you zoom out it shrinks to the top left, while the rest of the site stays centred.

Anyone got any ideas - and no, scrapping it all and starting again doesn't float my boat at all.

JohnnyPanic

1,282 posts

241 months

Friday 14th May 2010
quotequote all
Does it make any difference if you change
background-position:50%0px;
to
background-position:center top;

?

IME "center" always stays in the middle, where 50% sometimes just takes that as a start point and doesn't re-render if you change the size of the viewport.

mondeoman

Original Poster:

11,430 posts

298 months

Saturday 15th May 2010
quotequote all
Spot on!!

Thank you!