D
D
DarkByte20152016-11-30 17:54:16
css
DarkByte2015, 2016-11-30 17:54:16

How to make blocks of equal width in the center?

We need to make several blocks of equal width aligned in the center. The problem is that it is not known in advance how many there will be. Those. they are generated on the server. Otherwise, I would just use the modular grids from bootstrap as always. Of course, you can try to calculate the sizes and offsets of the grids on the server, but this is very dreary and shitty. Isn't it possible to simply do this?
P.S. Probably not very clear written. There may be several blocks, but they must be in the center. This does not mean that they should all crowd into a heap in the center, but simply evenly distributed over the parent block. If, for example, there is only one block, then it should be exactly in the center.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2016-11-30
@FFxSquall

something like this on flexbox , if I understood the task correctly.

I
iBird Rose, 2016-11-30
@iiiBird

make blocks with inline-block and set the parent to text-align: center;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question