Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS how to fully stretch background image that works in IE??

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33698
    warjie
    Member

    hi, i have a code here that stretch the background image..and works perfectly in Google and Firefox…but as usual,,,not with Internet Explorer…

    background-image: url(../Photos/logo_back%20copy.jpg);
    background-size: 100% 100%;
    background-repeat: repeat;

    and this is the code i got for IE versions:

    /* for IE 8 */

    -ms-filter:”progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’../Photos/logo_back%20copy.jpg’,sizingMethod=’scale’)”;

    /* for lower IE */

    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’../Photos/logo_back%20copy.jpg’,sizingMethod=’scale’);

    the code for IE works..but how can i use it? i mean how can i strict my CSS to use that code just for IE and not for other browsers? thanks a lot

    #84200
    #84201
    warjie
    Member

    hi @sl1dr:
    i have seen they are using this to solve the issue:

    but how can i use it inside my CSS???

    #84202

    Follow the instructions Chris gives in CSS Only Technique 1 or 2.

    #84203
    warjie
    Member

    hi, i created a different stylesheet only for IE for the background issue

    ..but nothing seems to happen??

    #116362
    louisremi
    Member

    In modern browsers you can now use the CSS3 property background-size

    .selector {
    /* will stretch the image so that it covers all of the element */
    background-size: cover;
    /* will stretch the image so that it fits perfectly inside the element */
    background-size: contain;
    }

    This allows to achieve background stretching while preserving the aspect ratio of the background-image: https://developer.mozilla.org/en-US/docs/CSS/background-size

    I’ve personally developed a polyfill that implements those properties in IE8: https://github.com/louisremi/background-size-polyfill

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.