0

I have a situation when I have a parent div and 2 inner divs. The first inner div should always be at the left-top, while the second div should be at the center of the parent div.

At first, div that should be at center wasn't at the true center of the parent div, but at the center of the gap that left between the first div and the end of the container:

enter image description here

To fix it I've made the first div absolute so it will be ignored:

enter image description here

But when I squeeze the container, they collide, instead of the centered div be down to the absolute element. Its probably because the absolute div is not taking into consideration, but I wonder if there is any way I can make it not collide.

This is my case:

enter image description here

And this is the desired case:

enter image description here

The parent element has:

text-align: center;

The blue element has:

display: block;

The red element has:

position: absolute;

Thanks.

Aviran Cohen
  • 5,581
  • 4
  • 48
  • 75

0 Answers0