If you must use hacks, then read this: http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-how-to-target-ie6-ie7-and-ie8-uniquely-with-4-characters/
But note that CSS hacks are considered evil.
Conditional comments are a good alternative. They are easy to use, and guaranteed to work properly.
You can't put conditional comments directly into a stylesheet, but what you can do is define a class in your <body>
tag using conditional comments, which you can then reference in the CSS:
Write your HTML <body>
tag like this:
<!--[if IE 6]> <body class="ie6 ltie7 ltie8 ltie9"> <![endif]-->
<!--[if IE 7]> <body class="ie7 ltie8 ltie9"> <![endif]-->
<!--[if IE 8]> <body class="ie8 ltie9"> <![endif]-->
<!--[if IE 9]> <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->
Then in your CSS, you can reference the relevant IE class in your selectors, and you'll have completely valid CSS code:
#topmenu li a.activa:hover {
/*normal styles here*/
}
.ie8 #topmenu li a.activa:hover {
/*IE8-specific styles here*/
}
Hope that helps.