Szymon Toda
Szymon Toda

Reputation: 4516

IE fails to show html background image (colour is ok)

So Chrome and FF are ok, just IE9 fails to show html background - it shows its colour, but no image. How I can make it to work propertly?

Test it on: here

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
html {
    width:100%;
    height:100%;
    background-color: #ffeacd;
    background-image: url(bg.png);
    background-position: 0px 0px;
    background-repeat: repeat-x;
    margin: 0px;
    padding: 0px;
}
body {
    background-position: center top;
    width:100%;
    height:100%;
    margin: 0px;
    padding: 0px;
    background-image: url(bg_overlay.png);
    background-repeat: no-repeat;
}
.content {
    width:1020px;
    height: 100%;
    padding: 0px;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
}
</style>
</head>
<body>
<div class="content"></div>
</body>
</html>

Upvotes: 0

Views: 274

Answers (1)

Steve
Steve

Reputation: 141

Seems IE is not allowing the background image tag on the html element. Try doing something like this.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body {
width:100%;
height:100%;
background-color: #ffeacd;
background-image: url(header-ad.png);
background-position: 0px 0px;
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
}
#wrapper {
background-position: center top;
width:100%;
height:100%;
margin: 0px;
padding: 0px;
background-image: url(hdr_GSA_lp.jpg);
background-repeat: no-repeat;
}
.content {
width:1020px;
height: 100%;
padding: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="content">

</div>
</div>
</body>

Upvotes: 3

Related Questions