2

I need to use css for ie9 to be float: left; but for all other browsers it should be float: none;. So, I tried the following which doesn't work:

li{
  float: none !important;
  float: left !important \9;
}

How can I target to IE9 only. I would prefer without including external css for this single line of css.

3 Answers 3

5

Use like this:

li{
  float: none !important;
  float: left \9 !important;/* \9 is used after left not after important*/
}

!important should always be at the end.

Sign up to request clarification or add additional context in comments.

2 Comments

You should avoid using !important
@Sidsec9 In some cases, we need to use it.
1

As you are defining css style, then !important should be at end. Try this

 float: left \9 !important;

Or you can use conditional comments

<!--[if IE 9]>
<style>
Special instructions for IE 9 here
</style>
<![endif]-->

Comments

0

I use something like this -

<!--[if IE 9]><!-->        
    //your style or script
<!--<![endif]-->

1 Comment

gte: greater then (or) equal. you are looking for [if IE 9]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.