Reputation: 15374
This is just a quick question for clarification really, I have a style sheet for ie7 and need to call it when someone is browsing via IE7, would the following in my application/layouts file call the ie7 stylesheet?
<!--[if lte IE 7]>
<%= stylesheet_link_tag "ie7", :media => "all" %>
<![endif]-->
Upvotes: 1
Views: 524
Reputation: 492
Yes, that should only bring in that stylesheet for IE7 and older browsers.
I find it's generally better to add a conditional class to the html tag via the following snippet, and then precede your IE rules with .lt-ieX
. This allows you to keep all your related rules together in the same stylesheet.
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
e.g.
.alert {
color: red;
}
.lt-ie7 .alert {
color: blue;
}
Upvotes: 1