I've found many responses that answer this question given a width. For example: Maintain the aspect ratio of a div with CSS
But if I need to set
div{
position: absolute
bottom: 10px;
top: 10px;
padding-right: 125%;
}
those solutions do not work.
How can I maintain the div's aspect ratio when I have the height set as above?
position: relative
to your div – Alin Mercasivh
units (1/100th of viewport height) like this:width: 40vh; height: 30vh;
. I am assuming that it's the height of the viewable area that you're concerned with, not the entire height of a web page. – Always Learning