background-size: cover Problem with <=IE8


#1

Hello,

I know <=IE8 doesn’t support background-size.
I need “background-size: cover” on my body for the background image.
That’s why I used this filter, which works.

	
	body {
        -ms-filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.jpg', sizingMethod='scale')";
	filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.jpg', sizingMethod='scale');
	height:1100px;
	}
	
<![endif]--></pre>

As you can see I had to define a height because else <=IE8 stretches the image according to the height of the page. With this height, it works for my notebook window size but it still stretches the image if I have a smaller or larger window.

I want that the background always has the full width and the proportional height. If the page is higher, the backgroundcolor should be used (the other browser do this automatically).

Can you help?


#2

Is there an easy solution or do I really have to change to a div with an image, especially for IE8 and IE7


#3

Perhaps this would be of use to you


#4

ok, so there is no way to make it work for the body element.

Should I use the DIVs with the image for all browsers or is it also a possibility to keep the background body tag in the other browsers and display the DIV only for <=IE8?


#5

Ok, I’ve done an extra version for <=IE8.
Thank you


#6

I created background-size-emu pure JS library that adds support of background-size to ie6, ie7, ie8 and ie9 in quirks mode.
It’s free and you can find it here: https://github.com/Metafalica/background-size-emu