145 posts
  • 3 Years of Membership
  • Austria
  • Collector Level 1
  • Exclusive Author
LovelessDesign
says

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.

<!--[if lte IE 8]>
    <style type="text/css">
    body {
        -ms-filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.jpg', sizingMethod='scale')";
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.jpg', sizingMethod='scale');
    height:1100px;
    }
    </style>
    <![endif]-->

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?

145 posts
  • 3 Years of Membership
  • Austria
  • Collector Level 1
  • Exclusive Author
LovelessDesign
says

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

3535 posts
  • Power Elite Author
  • Author Level 12
  • Trendsetter
  • United States
+13 more
sevenspark
Moderator
says
145 posts
  • 3 Years of Membership
  • Austria
  • Collector Level 1
  • Exclusive Author
LovelessDesign
says

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?

145 posts
  • 3 Years of Membership
  • Austria
  • Collector Level 1
  • Exclusive Author
LovelessDesign
says

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

1 post
  • 1 Year of Membership
metafalica
says

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

by
by
by
by
by
by