954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

CSS Background Property and IE

I am attempting to make my first website, however I have hit a hurdle in what appears to be browser compatability issues (or I could be talking nonsense?).

I am wanting to stretch an image to act as my background of my website,the only issue is it won't work in Internet Explorer yet shall work in Google Chrome and the W3Schools 'Try it yourself' tool.

<style type="text/css"> 
body
{
background:url("Background.jpg");
background-size:100% 100%;
background-repeat:no-repeat;
padding-top:40px;
}
</style>


I am using this in my Head and as I say, it works fine on other browsers but not in Internet Explorer. Is this just mine or is this an issue with all of them?
Is there anyway I can make this work for IE if it is a problem?

Thank you

AHarrisGsy
Light Poster
31 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Try setting the height of your body to the height of your background image and get rid of the background-size. Though for a set image background I personally would make a wrpper div to fit the body and put the css in their and leave the body to just have margin and padding set at 0.

simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

If your backgroug is repeating, then take the 1 pixel image either horizentaly or vertically (depends on your image) and repeate it to X or Y axis accordangily. If not then give the background image height and width in pixel.

sufyan2011
Junior Poster
166 posts since Dec 2011
Reputation Points: 9
Solved Threads: 20
 

Background url(); width:whateverpx; height:whateverpx; background-repeat:norepeat;

The issue with the coding is that the part "background-size:100% 100%;" isn't recognised as correct code by ie. If you're going to stretch the image, you need to declare the size as I have above.

richardtj
Newbie Poster
12 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: