0

I have a class in name of "myclass". In IE8, i need to apply the z-index as 5 for the "myclass" So i have tried to acheive it by using following methods.

.myclass{
z-index: 5\9  
}

---> It applies from IE10 onwards not only in IE8

.myclass{
z-index: 5 \0/ 
}

----> this also applies from IE10 onwards not only in IE8 and it create syntax error

How to acheive it only in IE8?

Karthik Ravichandran
  • 1,205
  • 2
  • 15
  • 25

3 Answers3

0

You should be able to use targeting.

<!--[if IE 8]>
...
<![endif]-->

Also, it appears as if a question similar to this has been asked before, Targeting only Firefox with CSS may be useful to you.

Community
  • 1
  • 1
Boo89100
  • 317
  • 2
  • 9
0

You may want to include a seperate CSS file by using a conditional comment to overwrite your css rule specifically in IE8. Example:

<link rel="stylesheet" type="text/css" src="/path/to/main-styles.css" />

<!-- The following lines will only be interpreted by IE version 8 or lower -->
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" src="/path/to/ie8-overwrites.css" />
<![endif]-->
VoodooDS
  • 610
  • 2
  • 10
  • 20
0

Try giving z-index with position relative or absolute. z-index might not work with static element. Try:

    .myclass{
        position:relative;
        z-index:5;
    }
AKSHAY JAIN
  • 236
  • 1
  • 6