One technique we use is the percentage trick on paddings to maintain aspect ratio in a div as the user scales their window. Here's an example:
.div {
background: red;
width: 80%;
margin: 0 auto 10px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-bottom: 20%;
}
Now, we want to set a maximum height for this div. Since the height of the div is determined by the padding and we need the div to be border-boxed, everything seems fine up to this point. But when attempting to use a max-height on the div, it doesn't work as expected.
.div {
max-height: 60px;
}
I've created a fiddle to demonstrate the issue: http://jsfiddle.net/UxuEB/3/.
I've tested this on Chrome, Firefox, and Internet Explorer. Can someone please help me understand what I'm doing wrong or why this isn't working as intended?