I'm trying to keep a div
element a specific ratio (say, 1:2), but keep the width less than 200px.
What I've got so far:
div {
width: 100%;
height: 0;
padding-bottom: 50%;
max-width: 200px;
}
It doesn't work - if I expand the window, the width stops expanding at 200px but the height keeps growing!
I've tried setting box-sizing: border-box
and max-height: 100px
, but neither work.
What should I do?
Here's a fiddle: http://jsfiddle.net/WVu3s/