How to style a div to be a responsive square? [duplicate]

I want my div to adapt its height to always equal its width. The width is percental. When the parent’s width decreases, the box should decrease by keeping its aspect ratio.

How to do this is CSS?

6 Answers
6

Leave a Comment