I want to target IE7 and IE8 with W3C-compliant CSS. Sometimes fixing CSS for one version does not fix for the other. How can I achieve this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Explicitly Target IE versions without hacks using HTML and CSS
Use this approach if you don’t want hacks in your CSS. Add a browser-unique class to the
<html>element so you can select based on browser later.Example
Then in your CSS you can very strictly access your target browser.
Example
For more information check out http://html5boilerplate.com/
Target IE versions with CSS “Hacks”
More to your point, here are the hacks that let you target IE versions.
Use “\9” to target IE8 and below.
Use “*” to target IE7 and below.
Use “_” to target IE6.
Example:
Update: Target IE10
IE10 does not recognize the conditional statements so you can use this to apply an “ie10” class to the
<html>element