Figure 1.4. The effect of the child combinator
The Adjacent Sibling Combinator
Withtheadjacentsiblingcombinator(+),wecanselectelementsthatfolloweach
otherandhavethesameparent.ItfollowsthepatternA+B.Styleswillbeapplied
toBelementsthatareimmediatelyprecededbyAelements.
Let’sgobacktoourexample.Noticethatourlabelsandinputssitnexttoeach
other.Thatmeanswecanusetheadjacentsiblingcombinatortomakethemsiton
separatelines:
label + input {
display: block;
clear: both;
}
YoucanseetheresultsinFigure1.5.
8 CSS Master