• Resolved figure2

    (@figure2)


    I just finished a site for a client. They are still using IE8. I noticed that my conditional IE CSS call to its stylesheet was displaying as code above the site. There are several people administering the site and this did not display consistently across all of their computers.

    URL is http://www.stratfordvna.org/

    Here is a screenshot from netrenderer.com. The code only appears under IE8 and disappears under IE7 and all later versions. Some people have told me that when they test it in IE8 they don’t see the code. It was clearly visible on my client’s computer.

    Here is the code I use for my IE conditional CSS tags in functions.php:

    // IE conditional wrapper
    add_filter( 'style_loader_tag', 'mark_ie_conditional', 10, 2 );
    function mark_ie_conditional( $tag, $handle ) {
    	if ( 'theme-ie7-only' == $handle ) {
    		$tag = '<!--[if lte IE 7]>' . "\n" . $tag . '<![endif]-->' . "\n";
    	} else if ( 'theme-ie8-only' == $handle ) {
    			$tag = '<!--[if lte IE 8]>' . "\n" . $tag . '<![endif]-->' . "\n";
    	}else { }
    		return $tag;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m thinking this has nothing to do with that function.

    Your screenshot shows lt IE 7, IE 7 and IE 8. But your code uses lte IE 7 and lte IE8. This is probably caused by the conditional lines just below your doctype declaration (the modernizr ones). More specifically, this one:
    <!--[if IEMobile 7 ]><html class="no-js iem7" manifest="default.appcache?v=1"><![endif]-->
    Which if have never seen before. That’s probably causing IE 8 to freak out. So leave above line out (I’m not sure what it’s for anyway) and it will probably work.

    On a sidenote. You should really try and use the IE classes the modernizr conditionals give you instead of loading a separate file. It’s what they are there for.

    Thread Starter figure2

    (@figure2)

    Thanks for the tip. This theme is built from the Starkers theme and that code was already in place. I’ll try removing it and see what happens.

    Modernizer allows the html5 and css3 elements to display in older versions of IE but I wasn’t happy with how some elements looked so the conditional CSS was to tweak those few issues.

    Thread Starter figure2

    (@figure2)

    I removed that code from the header with no apparent ill effects and the IE8 netrenderer.com test came out clean. Something I’ll definitely add to my workflow for the future.

    Thanks for the help.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Weird problem in IE8’ is closed to new replies.