views:

48

answers:

2

Hello,

I am trying to use a body background image which is center aligned, but it does not work in IE 6. The CSS for the body is

body{line-height: 160%;font-family: "Trebuchet MS", sans-serif; font-size: 80%; 

/*     background: #000a28 url('img/main_bg.png') no-repeat center top;*/
background-image:url('img/main_bg.png');
background-repeat:no-repeat;
background-attachment:scroll;
background-position:center top;
background-color: #000a28;
width: 100%;
margin: 0 auto;
color: #ffffff;
text-align: center!important}

For IE 6 I wrote the following CSS

body {
  text-align:center;
}

#main-wrapper {
  margin:0 auto;
  width:960px;
  text-align:left;
}

Please help me.

A: 

Try my code instead of your body's properties

body{
background:url('img/main_bg.png') #000a28 no-repeat center top;
color: #ffffff;
font-family: "Trebuchet MS", sans-serif; 
font-size: 80%;
line-height: 160%;
text-align: center;
}
eugeneK
No still its not working, while reloading its show that image is in center, but when page loads its back to left aligned.
saorabh
+2  A: 

The reason why it's not working is because of the SuperSleight transparent png script you are using. Because the script runs only after everything's loaded, the background first centers, then jumps back to the left when the script runs. As far as I'm aware, AlphaImageLoader does not allow for background position to be changed.

Try using this script instead: http://www.dillerdesign.com/experiment/DD_belatedPNG/. It uses a different solution which should allow for background-position to be used.

Yi Jiang