Answer the question
In order to leave comments, you need to log in
What selector should be used to determine the number of child classes available?
Hello everyone,
I have several divs described below with the class "parent", these divs are nested with other divs with the class "child" and "menu":
<div class="parent">
<div class="menu"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
<div class="parent">
<div class="menu"></div>
<div class="child"></div>
</div>
.child{
height: calc(400px / #количество дивов с классом "child");
}
Answer the question
In order to leave comments, you need to log in
This cannot be done with sass. he does not see the markup.
You can use regular css and tags
Here you can read more https://habr.com/en/post/252181/
I guess the :has selector in combination with :nth-child() will be able to do this. Unfortunately, CSS logical operations are still on an alluring horizon.
Therefore, since in the end the output will be carried out by one or another templating engine, it is easier to count the elements on it and set the parent modifier class, through which to carry out styling.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question