...

View Full Version : making background image fixed



Repatilian
05-18-2012, 08:15 PM
Hi, i was wondering if anyone could help me make my background image fixed and have the stuff on top of it scroll. I've tried to add background-attachment:fixed; to my bg element and bg img element and mainimg element. Here's what i have please help.

main.css:

html, body {
height:100%;
margin:0;
background-color:#000;
background-image:url(../images/firstpage.gif);
background-size:100% 100%;
background-repeat:no-repeat;


border:0;
padding:0;
}

defult.css:

body {
margin:0; padding:0;
background:#000000;

}
html, body, #bg {
height:100%;
width:100%;

border:0;
padding:0;
}
#bg {
position:absolute;
left:0;
right:0;
bottom:0;
top:0;
background-attachment:fixed;
z-index:0;
}
#bg img {
width:100%;
height:100%;
background-attachment:fixed;
}

defult2.css:

body {
margin:0; padding:0;
background:#000000;

}
html, body, #bg {
height:100%;
width:100%;

border:0;
padding:0;
}
#bg {
/*position:absolute; */
left:0;
right:0;
bottom:0;
top:0;
background-attachment:fixed;
z-index:0;
}
#mainimg {
width:100%;
height:100%;
background-attachment:fixed;
}

html:

<div id="bg" >

<img style="display:block;" id="mainimg" src="images/firstpage.gif"/>


</div>


thank you

Repatilian
05-18-2012, 08:15 PM
the page is www.marksbodyshop.org

Repatilian
05-18-2012, 08:51 PM
i got it nevermind i added position:fixed; to the elements in the css but i added background-attachment:fixed; to the main.css



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum