SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Gradients and IE9 and <

    Hi,

    I'm just trying to get the following to work in IE 9 and lower:

    Code:
    .widget-title, .modal-header, .table th, div.dataTables_wrapper .ui-widget-header {
    	background-color:  #efefef;
    	background-image: -webkit-gradient(linear, 0 0%, 0 100%, from(#fdfdfd), to(#eaeaea));
    	background-image: -webkit-linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
        background-image: -moz-linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
        background-image: -ms-linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
        background-image: -o-linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
        background-image: -linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#eaeaea',GradientType=0 ); /* IE6-9 */
        border-bottom: 1px solid #CDCDCD;
        height: 36px;
    }
    I'm aware that gradients dont work correctly in very old versions of IE (but our site is really designed with IE8+):

    http://steampunkjunkies.com/

    Can anyone shed any light on why the "headers" of those boxes show up orange in IE10, FF, Chrome, Safari etc... yet in IE 9 they come up as a grey?

    TIA!

    Andy

  2. #2
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No one? Got the same problem on another site now - I'd really like to get this going :/

    damn IE!!!!!

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,555
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi.

    I've only had a quick look but it seems to me you are not getting any gradient on the titles at all in browsers other than IE because you over-write it with this rule here that follows the rules you showed above.
    Code:
    .widget-title {
    	overflow: hidden;
        color: #F5F7F7;
    	text-shadow: 0 1px 0 #000;
    	background: #C46328; 
    	font-size: 1.3em;
    }
    linear gradients are supplied via the background-image property and you are setting them to none and just giving them an orange colour (#C46328). Therefore all browsers (except ie9 and under) just get orange.

    IE9 (and under) on the other hand are getting this rule:

    Code:
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#eaeaea',GradientType=0 ); /* IE6-9 */
    Which is not cancelled out as the filter takes over the background as a whole and background colours are ignored. The gradient you are using is lighter gray to light gray so all you see is gray. So in fact IE9 and under are the only ones showing a linear gradient at all.

    If you want a gradient in IE9 then supply the values in the filter as required. Maybe something like this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    <style>
    .test1, .test2 {
     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#C46328', GradientType=0 ); /* IE6-9 */
    	width:200px;
    	height:100px;
    }
    </style>
    </head>
    
    <body>
    <div class="test1">test1</div>
    </body>
    </html>
    However if you just want the page to look like others then remove the filter completely and let the same background show through that other browsers are getting.

  4. #4
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Ah man, now I feel stupid - especially seeing as that class was right below the one I was looking at Commenting that out, and changing the filter colors means it now works all the way back to 8 (which is old enough for me, as thats what the design is coded to work back to <G>)

    Thanks a ton!

    Andy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •