Background doesn't stretch to fill page in IE8

Discussion in 'CSS' started by fadetoblack22, Sep 3, 2011.

  1. #1
    fadetoblack22, Sep 3, 2011 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    hdewantara, Sep 4, 2011 IP
  3. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #3
    The problem with that is the massive file size. Is there no way to do it at all?
     
    fadetoblack22, Sep 4, 2011 IP
  4. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #4
    True... if you are saving in high quality.

    I think there is an option to reduce the JPEG quality so that you'll get the "optimum" size (< 100-150KB?): your visitor gets fast image download in a still acceptable quality. Even in FF and using that "background-size" CSS property, there is a loss in quality when you stretched your browser to full screen, isn't it? :)

    There are a few tricks out there which let you have stretched background in IE, I forget where. But all require a change in HTML structure: the image file is no longer a CSS background-image, but is an HTML <img> element.

    Hendra
     
    hdewantara, Sep 4, 2011 IP
  5. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #5
    At the moment it's a lot less than that at about 85kb. Thanks for the suggestions. I think I will override it with a background colour and in an Lte IE css file. Any idea how to stop the background image popping up for a second before the IE css file loads?

    Thanks.
     
    fadetoblack22, Sep 5, 2011 IP
  6. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #6
    Did you mean delaying the background for a second like the following:
    [COLOR="#0000FF"]<script type="text/javascript">
    function onLoadDelayed(){
    	document.getElementsByTagName("html")[0].style.backgroundImage = 
    		"url('http://www.bigfreebet.com/images/site/backgroundimg.jpg')";
    }
    </script>[/COLOR]
    </head>
    
    <!--<body onLoad="checkCookie();">-->
    
    <body [COLOR="#0000FF"]onload="setTimeout(onLoadDelayed,1000)"[/COLOR]>
    Code (markup):
    You have to chage style.css a bit though:
    html {
    [COLOR="#0000FF"]	/*background: url(http://www.bigfreebet.com/images/site/backgroundimg.jpg) no-repeat center center fixed;*/
    [/COLOR]	-webkit-background-size: cover;
    	-moz-background-size: cover;
    	-o-background-size: cover;
    	background-size: cover;
    	[COLOR="#0000FF"]background-repeat: no-repeat;
    	background-position: center center;
    	background-attachment: fixed;[/COLOR]
    }
    Code (markup):
    *changes are in blue.
     
    Last edited: Sep 5, 2011
    hdewantara, Sep 5, 2011 IP
  7. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #7
    Hey, thanks for the reply! That's kind of what I mean. I only want it delayed in IE though where I am using the bg colour over the top of it. Have you seen it on the site? In IE the bg annoyingly pops up for around a second before the IE css loads to place the bg colour over the top of it.
     
    fadetoblack22, Sep 6, 2011 IP
  8. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #8
    Any Ideas about this?
     
    fadetoblack22, Sep 15, 2011 IP
  9. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #9
    conditional stylesheet - take that property out of your main stylesheet and put in a second file... - load if NOT IE but if IE don't load it.
     
    workingsmart, Sep 15, 2011 IP