A
A
Alexey Sklyarov2018-02-23 13:01:00
css
Alexey Sklyarov, 2018-02-23 13:01:00

How to align a grid of elements if justify-content:space-between doesn't fit?

https://jsfiddle.net/gkho05oc/1/
The problem is the following: I don't know the number of labels, there may be 3, maybe 15. Initially, I wrote something similar: for each next label to retreat by 4 px, but if place 4+ labels in sequence, then the labels go crooked on the next line. It is understandable, but writing is not an option, because it will have to be adapted for each border of the browser window width. How can using (maybe something else) make sure that the blocks are not placed at the edges, but have the behavior of floats? Actually, a question similar to mine is described here: https://stackoverflow.com/questions/32205152/using....item + .item {margin-left:4px}:nth-of-type(4) {margin-left:0}
justify-content:space-between
However, I am not satisfied with these crutches in the form of hidden blocks, etc., because, as I say, the number of blocks is not known to me.
This problem occurs quite often, how is it generally solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Odisseya, 2018-02-23
@Odisseya

justify-content: flex-start;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question