r---------k r---------k - 1 year ago 191
CSS Question

css child (>) selector not working in IE8?

From what I gathered and understood here and there (stop me when I'm wrong) :
child selector (>) works on IE7+ as long as you trigger the standards mode with your doctype, html5's

<!DOCTYPE html>
is supposed to do this.

Still, my css:

nav > ul > li > a
padding: 0.2em 2em 0.2em 2em;
background-color: #FAFAFA;
nav > ul > li > a:hover
background-color: #AFAFAF;

doesn't seem to reach my html:

<!DOCTYPE html>
<a class="inblock valignC logo" href="/"><img src="static/img/logo.gif" /></a>
<!--Menu nav : LOGO | Agence | Portfolio | Equipe | Clients | Contact-->
<ul class="inblock valignC">
<li class="inline"><a class="ie" href="/agence/">Agence</a></li>

in IE8, I have to use the dedicated .ie class I added on targetted

Any explaination ?

Answer Source

You need to use the HTML5 Shiv for IE versions under 9:

<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>