Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8506315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:33:40+00:00 2026-06-11T02:33:40+00:00

What is the common practice for maintaining IE workarounds in a separate CSS file?

  • 0

What is the common practice for maintaining IE workarounds in a separate CSS file? I’m talking about deeper issues that are impractical to work out by other means (such as including an alternative image url along with a base64-encoded embedded resource; boxsizing.htc workaround etc.) NB: I’m conservative when considering dataURI vs vanilla spriting, so there are only a few

Sometimes I have to resort to code similar to

.some-class-lets-say-datepicker {
  background-image: url(data:image/png;base64,/*encoded image*/);
  *background-image: url(../gfx/lets-say-datepicker-icon.png);
}

with the encoded image string being on average 100~300 chars. Given the code above, this causes some redundand traffic – for compliant browsers to download the redundand URL, and for IE7 to download the base64 stringon top of the separate image request. I find this overhead to be insignificant for both (and, after all, IE7 users have much bigger issues to be worried about 🙂

At the same time the following would (?) be a lot cleaner:

<!--[if !IE]> -->
  <link href="main.css" rel="stylesheet" />
<!-- <![endif]-->
<!--[if lt IE 8]>
  <link href="main_ie.css" rel="stylesheet"/>
<![endif]-->

but separate maintenance does not seem appealing at all. Closure-stylesheets offer conditionals, is there something similar for SASS/LESS or is there a different approach altogether that you’d recommend?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:33:42+00:00Added an answer on June 11, 2026 at 2:33 am

    Sass (version 3.2+) can do this fairly easily if you’re ok with generating 2 different stylesheets.

    Here’s your mixins:

    $ie-only: false !default;
    
    @mixin hide-from-ie {
        if $ie-only != true {
            @content;
        }
    }
    
    @mixin show-only-ie {
        if $ie-only == true {
            @content;
        }
    }
    

    In your SCSS files:

    .some-class-lets-say-datepicker {
        @include hide-from-ie {
            background-image: url(data:image/png;base64,/*encoded image*/);
        }
    
        @include show-only-ie {
            background-image: url(../gfx/lets-say-datepicker-icon.png);
        }
    }
    

    Make a separate IE-only file that imports your other SCSS files, but has this at the top:

    $ie-only: true;
    

    Use conditional comments to serve old IE versions the generated css file with $ie-only set to true, and every other browser gets the one generated with $ie-only set to the default false.

    Inspiration for this technique was found here: http://jakearchibald.github.com/sass-ie/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am aware that most common practice would be to put var a,b; on
It's most common practice to register routes in Application_Start event within global.asax.cs/vb file. But
I know that in Java, it is common practice to use get as a
It has become common practice to use CDNs for caching javascript, css, font's and
it's a pretty common practice that constants are prefixed with k (e.g. k_pi ).
In OpenGL it is a common practice to orphan buffers that are used frequently.
It is a common practice in CSS to use {cursor: hand; cursor: pointer} for
I'm working on a CMS and I'm trying to figure out the common practice
I used to work in a place where a common practice was to use
I know that a common practice is to set an expire time far in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.