Grow your CSS skills. Land your dream job.

IE8 compatibility mode conditional statements

  • # September 17, 2009 at 4:46 pm

    Hi, this is my first post for what it’s worth. I did a couple searches and nothing came up for my issue. I am a web developer and I understand CSS very well.

    Previously I’ve found that using conditional statements to target (explorer versions) is a simple way to solve issues. I add the conditional statement and create a style sheet for IE6 or IE7, throw in a few altered rules, and everything works fine.

    Well I recently was mislead into upgrading to IE8 because I was told the compatibility feature would mimic IE7. Unfortunately, it appears that compatability mode does not read the sheet that is targeting IE7.

    So my specific question is: there a way to get IE8 compatibility mode to actually read a style sheet targeting IE7. Whether it is a matter of the phrasing of the conditional statement or what. Hopefully this is clear in what I am seeking.

    Thanks for any help,

    Tom C

    (edited to spell compatibility correctly lol)

    # September 17, 2009 at 5:50 pm

    <!–[if gte IE 7]>
    if greater than or equal to IE7 (IE 7, 8, 9, etc.)
    <![endif]–>

    # September 17, 2009 at 11:09 pm

    Hey, thanks for the reply.

    The thing is what if I also want to target IE8 separately also…if I use gte IE7 for one sheet and gte IE8 for another sheet…which one will IE8 use in compatability mode?

    The crux of the problem is what is IE8 doing in compatability mode. If it was saying "hello web page, I am acting like I am IE7 now" there would be no problem; but it appears it is really saying "hello, I am IE8 but I am going to render things like IE7 would". Those are two completely different things. I’ve spent some time searching microsofts developer site and they go into great detail dealing with everything but I cannot find anything explaining this.

    Tom C

    # September 17, 2009 at 11:53 pm

    Hmmm. So, the only thing that this issue is affecting is your ability to test on IE7? I know it’s an annoyance, but I don’t think there is much difference between the way IE7 and IE8 render. Not like the difference between IE6 and IE7.

    I am procrastinating writing an essay, so I browsed around for like 20 mins to find a solution. Lol… I was reading the blog entries the IE team wrote when they were talking about the IE8 compatibility mode features. Half of the comments are from people saying things like "Way to hold back the web." lol… the other half was the IE team blog links in other languages.

    Some day… all browsers will use the same rendering techniques? I don’t care who, even if all browsers have to render like fucking IE, at least they will all be the same.

    # September 18, 2009 at 12:53 am

    Yes that is exactly it. The ability to test in IE7. Certainly, IE7 is no IE6 lol. But I had direct experience with this yesterday while working on a site. There were very few "bugs" in IE8 but enough to need two or three rules in it’s own sheet. Whereas the IE7 sheet needed 8 -10 rules. (we were not supporting IE6). IE8 needed less rules than Chrome for what it’s worth. But during the course of this I upgraded to IE8 when told about the compatibility feature. But at that point I stopped being able to see the changes to the IE7 sheet.

    Now i have to note this site was using "less than or equal to" for both conditional statements as opposed to "greater than or equal to". Which I thought might solve it just as you did when suggesting it. Even though in my mind logically it could go either way, it was more of a shot in the dark. But I did not have direct access to the head.php include, the other developer said he would try changing it when he could but never got around to it.

    (As you saw yourself, there is scads of information on the MS site, some of it going way over my head, but three quarters of it is the same old grousing about why microsoft is doing this and not that. And many other web searches regarding the issue seem to end up on forums discussing IE8 beta from 6 months ago.)

    Sorry for the long winded reply to my own post but maybe this will help someone else out by knowing all the details!

    ANYHOW I finally did a simple test here http://www.virtualdesignlab.com/testing_html/ie8_compatability_mode_test.html and it turns out I had nothing to worry about. Compatibility mode does indeed see the IE7 sheet if you use GTE rather than LTE in the conditional statements. And it sees the IE8 sheet when switched off. I also tested the "emulate IE7" meta tag and it behaves the same way. Maybe a whole lot of hoo hah over nothing but at least now I/others can know for sure. Thanks for your replies!

    Tom C

    # September 18, 2009 at 9:17 am

    Glad it’s fix :D I wasn’t going to even worry about differences between IE7 and IE8 since I didn’t think the time it took to check that browser out weighed the few negative differences, but if it’s just as easy as switching to compatibility mode, I’ll start doing it :D

    # September 18, 2009 at 2:06 pm

    Well a lot of times it might be just a few pixels here and there or nothing at all; it really depends on how the site was built. But once in a while it can be very awkward, such as a menu that is overlappping another link. So it’s really worth it just to check and make sure there is nothing too extreme.

    Tom C

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".