Answer the question
In order to leave comments, you need to log in
Does the "+" combinator in CSS select only 1 subsequent element, or several?
Tell me how exactly the plus sign combinator works, some manuals say that it selects several elements that immediately follow the "parent", other manuals say that only one subsequent element will be selected. Or neither?
Answer the question
In order to leave comments, you need to log in
a ~ b
– right neighbors: all b at the same nesting level that come after a . – first right neighbor: b at the same nesting level that comes immediately after a
In lists, it is convenient to set the indents between elements with the combination :
.list-item + .list-item {
margin-top: 10px;
}
.list-item {
& + & {
margin-top: 10px;
}
}
<ul>
<li class="list-item"></li>
<li class="list-item"></li>
<li class="list-item"></li>
<li class="list-item"></li>
<!-- ... -->
<li class="list-item"></li>
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question