I know I can achieve responsive square divs that maintain their apsect ratio using CSS like this:
The problem is, the div size is always relative to the parent/window. I would like the div to have a fixed max width as long as the window/screen isn't smaller. As you would with a normal responsive image. Is this even possible?
I tried...
.some-class {
width: 100%;
padding-bottom: 100%;
max-width: 520px;
}
The div maintains its aspect ratio width a 520px width but when the screen is smaller, the height stays the same. So I get more height, instead a square div. It doesn't keep the aspect ratio.