Skip to main content

Forums

This topic contains 5 replies, has 0 voices, and was last updated by  mmcgu1966 7 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35955

    mmcgu1966
    Participant

    Instead of having HTML conditional comments load IE-specific stylesheets, you can use conditional comments to put content into the HTML, including different statements. In this case, I’m using three classes: .ie, .old_ie, and .ie_nine. If it’s not IE, it uses a standard element with no class. Take a look at this block of code:






    In the stylesheet, I have an INTERNET EXPLORER section down at the bottom and any IE specific code can refer to the .ie, .ie_nine, or .old_ie classes. For example, if my footer has a transparent background color, IE9 can handle it, but older IE can’t, so I would refer to .old_ie footer { } in the IE part of the stylesheet.

    Besides wanting to share… anybody know if this sort of trick is a bad idea?

    #93948

    Chris Coyier
    Keymaster

    I’m a fan. I think it’s becoming kind of the standard way of handling it actually. Re: HTML5 Boilerplate:

    https://github.com/h5bp/html5-boilerplate/blob/master/index.html

    #93949

    TheDoc
    Moderator

    Very interesting. I don’t know why I’ve never thought to do this. I like it a lot!

    #93953

    kgscott284
    Participant

    This reply has been reported for inappropriate content.

    I use that method all the time, it has made my life a million times easier.

    I say go for it…IE conditionals are meant to hold specific IE content after all.

    #94338

    mmcgu1966
    Participant

    This reply has been reported for inappropriate content.

    Turns out, this is badly formatted HTML, but is Microsoft’s badly formatted HTML, specifically for IE. Here’s my updated version.. note the different HTML format between the IE and !IE lines.

    Oddly, Boilerplate doesn’t look like it includes a not-IE option and ends-up not having an HTML tag (it modifies the HTML tag instead of the body tag as I am.












    <!--
    #94346

    OniLinkCR
    Member

    I use Paul Irish’ approach. I don’t know if it’s the same as the Boilerplate, but I recommend it.

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

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star