D
D
Dmitry Kachurinets2018-08-25 16:37:17
Flexbox
Dmitry Kachurinets, 2018-08-25 16:37:17

How to position blocks with flexbox?

Sandbox .

1) Now in my layout this select is on the right:

5b815aac70fde115917935.png

But when there is not enough space for it, then it goes down:

5b815b2184f0e245364224.png

I want to make it so that when there is no space for it, it is pressed to the left side, and when there is to the right.

2) How to align this filter to the center on the mobile version? Tried different properties, but it doesn't work.

5b815b840e98a243148596.png

3) How to make an adaptive on this page in general and how best to position all these blocks on smaller screens?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Sharapenkov, 2018-08-25
@angryblacker

1) Can be done with media queries
2) Add to .filter,

width: 100%;
display: flex;
flex-direction: column;
align-items: center;

if it is necessary to be centered only for the mobile version, then also media queries. If anything, mixing them with Flexbox is legal.

S
snap44, 2018-08-25
@snap44

1 remove auto-margin on the left of the block with select and add justify-content to the parent

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question