Please tell me why first-child does not work. NEW
How can I set styles for the first child element of .all
?
Necessarily!!!!
I don't know the exact index of the desired element.
Necessarily!!!!
#one {
width: 500px;
height: 250px;
border: 1px solid;
font-size: 0px;
}
#one #two {
width: 100%;
height: 50px;
background: blue;
}
#one .all {
width: 250px;
height: 200px;
background: green;
display: inline-block;
}
#one .all:first-child(1) {
background: grey;
}
<div id="one">
<div id="two"></div>
<div class="all"></div>
<div class="all"></div>
</div>