Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Responsive Layouts Responsive Theory Course Overview

John Haas
John Haas
1,756 Points

Media queries don't work in IE8 and earlier. Any way to get around this?

I know media queries were only incorporated into IE9 and above. Are there any solid ways (for professional use) to utilize a javascript pluggin or something that mimics the media queries in these earlier browsers?

8 Answers

John Haas
John Haas
1,756 Points

Awesome thanks Alex. Would you personally go with restive over modernizr for responsive solutions? Any preference?

Please forget IE8. There should be a law to forbid using IE8 and earlier versions. Even google dropped support to Jurassic browsers.

Make sure you get paid really good for supporting Jurassic versions of IE. Because you are basically working in something that is already obsolete therefore you are wasting your time in learning something that you will never use again.

John Haas
John Haas
1,756 Points

I completely agree. Unfortunately, there are major businesses that still use that browser.

True. But it's a very specific niche. That's why I said make sure you are get well paid because that knowledge isn't going to be applied anymore in like 3 or 4 years.

If you are looking for a basic, out-of-the-box solution, you could use Respond.js.

I usually start a project with the conditional comment code that Twitter Bootstrap recommends in their sample template, and supplement with more nuanced solutions like Modernizer if needed.

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

The html5shiv is technically not needed for media queries, but if you are using modern techniques like media queries, you probably also should allow yourself the freedom to use HTML 5 elements as well. I've often seen them paired together.

This may not solve all your IE 8 support issues, but it's a good start.

Good luck.

Daniel Kurowski
Daniel Kurowski
11,231 Points

I think even Microsoft stopped supporting IE8. Thank God for that - it's a sign ;)

John Ireland
John Ireland
6,585 Points

I'm currently collecting people for a mob, and together we will hunt down all those who use this dark technology known as "Internet Explorer", and modernize them. Anyone else down?

I think the best way is to have an honest conversation with the business. Is it essential to put resource and budget into older browsers, rather than invest in other modern features to enhance the product further?

There is repond.js as mentioned above, but my goal these days are to only include additional code if absolutely necessary.

If I can serve a stacked mobile -esque layout to an IE6,7 & 8 user, then I will. They are on these devices to access content, and not much more than that.

Gerhard Driedger
Gerhard Driedger
7,486 Points

I don't think that anyone using an outdated browser should expect to have the same advantages that modern browsers have. When I play Final Fantasy 3 on SNES, I wont complain that the graphics don't compare to Final Fantasy 14 on a PS3. So I say let the dinosaurs die without responsive design.