Atr_Max Atr_Max - 1 year ago 85
CSS Question

Put element ABOVE another element

we have this weird situation where we have the following DOM:

<div class="container1"> ... </div>
<div class="container2"> ... </div>

We now want that container2 appears ABOVE container1.
Normally, both containers are wrapper beside each other,
is the main content and
is the sidebar.

The Sidebar has to be OVER the main content. Both elements have an unknown height.

How can I fix this?

Answer Source

Try with display: flex and order.

   display: flex;
  flex-direction: column;

  height: 100px;
  width: 100px;

   background: blue;
  order: 2;

  background: red;
  order: 1;
<div class="first"></div>
<div class="second"></div>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download