Forums

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

Home Forums Other Conditional Comments – Which practice is the best?

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #190931
    kayut
    Participant

    Hi Guys,

    Which of the following 2 methods is the best approach for using conditional comments for different IE versions:

    Method 1
    Loading different stylesheets for different version of IE:

    <link href="main.css" rel="stylesheet" type="text/css">
    <!--[if IE 9]> <link href="ie9.css" rel="stylesheet" type="text/css"> <![endif]-->
    <!--[if IE 8]> <link href="ie8.css" rel="stylesheet" type="text/css"> <![endif]-->
    <!--[if IE 7]> <link href="ie7.css" rel="stylesheet" type="text/css"> <![endif]-->
    <!--[if IE 6]> <link href="ie6.css" rel="stylesheet" type="text/css"> <![endif]-->

    Method 2

    <!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
    <!--[if IE 7 ]> <html class="ie7"> <![endif]-->
    <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
    <!--[if IE 9 ]> <html class="ie9"> <![endif]-->

    And then adding your target with the corresponding IE class you want to hack.

    Thanks

    #190934
    Paulie_D
    Member

    It’s entirely up to you. There is no ‘best practice’ …just whatever works for you.

    Personally, I’m in favour of the first approach…not that I support IE8 anyway….and I’m moving away from IE9 too.

    #190972
    TheDoc
    Member

    Only people that would probably ever use a version before IE9 these days are webnerds doing theoretical/archaic experimenting or the rare civil servant that must still revert to XP and is forced to use no other browser for some reason. I wouldn’t bother at all myself…

    Completely depends on the client. The majority of projects I have worked on over the past couple of years still see a massive amount of traffic from IE8 (you can blame Vista for that).

    For me, it’s definitely Method 2. If you’re coding with progressive enhancement in mind then you shouldn’t need dedicated stylesheets for each IE. I usually just need to make a lt-ie9 mixin and that’s it.

    .some-element {
      /* regular styles */
    
      @include lt-ie9 {
        /* some sort of override for < IE9 */
      }
    }
    
    #190976
    theacefes
    Participant

    Actually, there were a number of things that IE got right the first time that other browsers did not have. And the other browsers have their disadvantages. Firefox for the longest time had terrible dev tools and web developers relied on a plugin to dev on it. Also, it had a period where it became an ugly memory hog. Chrome took a bit to mature to a point where it was worth using. And remember that not everyone here is a freelancer or has the freedom to develop for the latest and greatest. Some of us work on enterprise software – we have to support whatever browser the IT and clients of a company are using. I’ll take $$ and security over the shiny browser any day.

    #190993
    Anonymous
    Inactive

    I guess some people are stubborn to use a proper browser

    Ahem. At work I have no 3G, no wifi, and use a remote desktop with XP and IE8 with no ability to install software. Dropped support for IE8? Fine. I can’t use your site. Image heavy? I can’t scroll down without waiting 20 seconds between repaints.

    For most sites, it doesn’t make one iota of difference whether I’m considered. I don’t browse non-work-related sites while at work. But some are mission-critical and it’s frustrating when I can’t access content. For example, the UK poisons information service site is both image-heavy and renders poorly, making it hard to find their phone number.

    As in all sectors, know your audience.

    #191149
    kayut
    Participant

    I guess another disadvantage of Method 1 is, creating more HTML requests.

    But I really love to know more about the Sass solution of “The Doc”:

    .some-element {
      /* regular styles */
    
    @include lt-ie9 {
        /* some sort of override for < IE9 */
      }
    }
    
    

    Do I need to add a class .lt-ie9 to those elements, which need especial treatment for IE 8 and lower?

    Or how else does it work?

    Thanks

    #191828
    kayut
    Participant

    Is my question that stupid that no one want to answer it? :-(

    #191830
    Paulie_D
    Member

    It’s entirely up to you. There is no ‘best practice’ …just whatever works for you.

    #191841
    kayut
    Participant

    Sure, but I’m talking about my last question about “The Doc” solutiion.

    I really love to know more about the Sass solution of “The Doc”:

    .some-element {
      /* regular styles */
    
    @include lt-ie9 {
        /* some sort of override for &lt; IE9 */
      }
    }
    

    Do I need to add a class .lt-ie9 to those elements, which need especial treatment for IE 8 and lower?

    Or how else does it work?

    #192210
    kayut
    Participant

    In other word if lt-ie9 is a Sass Mixin, how does it look like?

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