Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
Created June 11, 2014 11:32
Show Gist options
  • Save kalinchernev/1f92d0a37edcb53a7e34 to your computer and use it in GitHub Desktop.
Save kalinchernev/1f92d0a37edcb53a7e34 to your computer and use it in GitHub Desktop.
Selecting children elements in IE
/* equivalent to li:nth-child(1) */
#mainNav ul li:first-child a {
background: #1b77af;
width: 236px;
text-align: center;
margin-right: 10px;
}
/* equivalent to li:nth-child(2) */
#mainNav ul li:first-child + li a {
background: #33a0ff;
}
/* equivalent to li:nth-child(3) */
#mainNav ul li:first-child + li + li a {
background: #de7803;
}​
/* equivalent to li:nth-child(4) */
#mainNav ul li:first-child + li + li + li a {
background: #d94e4e;
}​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment