I've been using this approach on some newer projects (still in private dev), but don't know the browser support for it or why the height is even able to mimic the width size. Does anyone know why this happens? Thanks!

1 Answer
1

The second element is positioned absolutely relative to is container. Which is positioned relative.

In CSS, percentage based padding is relative to the width of the element. That is what creates the square effect.

And is also why if you add the same size padding to all sides, all sides have the same percentage of padding. It is relative to one measurement (width) and NOT both width and height. that would cause the padding to be skewed if the the element was not square.