PDA

View Full Version : IE background fix for HTML not PHP



scottie5689
21 Apr 2011, 12:00 AM
I am developing a website where my background need to stretch to the fit all windows no matter size or browser. I originally started with CSS3 background-size property. It worked fine but not in IE. I found the IE fix,

<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>


<img src="bgimage.jpg" alt="background image" id="bg" />
</body>

mg#bg {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}


This worked fine when placed in a html page. However, when the image is placed into a PHP page and linked to the CSS it does not work. I get a broken image link box but no image. I have tried it now with png and gif image types. I know HTML and CSS well, not so much PHP.

Wickham
21 Apr 2011, 02:06 AM
I use more or less the same position: fixed code with PHP and it does work. It could be the path from the css file which is different in your PHP page.
http://www.wickham43.net/backgroundfullwidthflexible.html
However, you don't need the html, body {height: 100%;} unless there is something else that you need it for.