Shahab Ali
Shahab Ali

Reputation: 399

Place one div to the right of another CSS

This question might look duplicate but it isn't. I have 5 divs. I only want to place div 2 to the right of div 4 using CSS. How can I do that? I have gone through all the present questions on placing one div to the right of other but they only include 2 divs while asking for one div to be place on the right of other. What if there were more than 2 divs. Also I don't want other divs 1,3 and 5 to be effected.

<div class="container">
   <div class="div1">
    div1
   </div>
   <div class="div2">
    div2 to be place on right of div4
   </div>
   <div class="div3">
    div3
   </div>
   <div class="div4">
    div4 to be placed on left of div2
   </div>
   <div class="div5">
    div5
   </div>
</div> 

Upvotes: 0

Views: 66

Answers (1)

Techek
Techek

Reputation: 475

With flexbox and order, you can control the exact display-order of the elements.

Upvotes: 1

Related Questions