0

Centering vertically a absolutely positioned iframe inside a div without having to manually set the height and width for all elements?

So I am hurting my head against the wall with a tricky issue relating to absolutely positioned items. It seems that absolutely positioned item don't have width and height and have to be set manually. Or at least it breaks the other divs so that you need to set their width and height manually, which isn't what I want.

  position: absolute;
  top: 50%;
  transform: translateY(-50%);

I put this in the wrapper div and it breaks everything and sets everything to 0 width.

Is there a way to do this without creating a mess?

https://codepen.io/codepen_user_123/pen/xxELyMb

Sayaman
  • 1,145
  • 4
  • 14
  • 35

0 Answers0