<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
-sharpul{ width:50%;}
li{ background:-sharpf5f5f5; border-bottom:1px solid -sharpddd; padding:5px 0; }
-sharpul li:nth-child(n+5){ background:-sharpF90}
</style>
</head>
<body>
<ul id="ul">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
</ul>
</body>
</html>
the above code selects
from the fourth child element.<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
-sharpul{ width:50%;}
li{ background:-sharpf5f5f5; border-bottom:1px solid -sharpddd; padding:5px 0; }
-sharpul li:nth-child(n+5){ background:-sharpF90}
</style>
</head>
<body>
<ul id="ul">
<script>
for(var i=1;i<=12;iPP){
document.write("<li>" + i + "</li>")
}
</script>
</ul>
</body>
</html>
the above code selects
from the third child element.Why is this?