Answer the question
In order to leave comments, you need to log in
Is it possible to calculate the block width depending on the number of all blocks?
Good afternoon! There is a wrapper whose width is 100%. Is it possible to somehow calculate the width of a child block using sass, depending on the number of these same blocks? For example, if we have 4 blocks, then their width will be 25% each, and so on...
Answer the question
In order to leave comments, you need to log in
Maybe just layout on flexbox?
https://developer.mozilla.org/ru/docs/Learn/CSS/CS...
после каждого четного блока вставляем < div class="clearfix">< /div >
<col-6>
<col-6>
<div class="col-md-12></div>
<col-6>
<col-6>
<div class="col-md-12></div>
<col-6>
<col-6>
You have a mistake in writing the image address in the block with id="block21". And something is wrong with the DIVs, the 1st, it seems, is superfluous. Also, no offense, the code is very overloaded. Also a terrible situation with id and class. Next, you specify the sizes of the images in the HTML code. Please do it with CSS.
Now to the process itself. Based on your CSS code, you line up blocks using margins and padding. With the current code, you can't even get the first picture, all the blocks are aligned in the center and go from top to bottom, one under the other. You didn't even write exactly how you want to align them. Always 2 blocks in a row? Or does it change with window size?
I simplified your code by throwing out things that are not related to the subject of discussion.
Maybe you like this behavior of blocks more? tyts!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question