K
K
keche2017-03-21 17:47:11
css
keche, 2017-03-21 17:47:11

How to swap divs?

An example is 4 blocks codepen.io/Keche/pen/JWMPBa
If you create conditions for the blocks to line up under each other. Then the sequence of blocks will be as follows:
Block 1
Block 2
Block 3
Block 4
And how to make it so that with adaptability it would be like this:
Block1
Block3
Block2
Block4

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Novamoscow, 2017-03-21
@Novamoscow

If you can use flexbox. That is very simple.
If not, I solved this problem by duplicating the block.

S
Sergey Goryachev, 2017-03-21
@webirus

flexbox - codepen.io/anon/pen/evMjyG

E
Evgeny Kravchenko, 2017-03-21
@evgenyj_kravchenko

Just put blocks 1 and 3 in one div, and 2 and 4 in another. In the styles of the new blocks, set the rubber width and "float: left"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question