I would like to use media queries to resize elements based on the size of a div element they are in. I cannot use the screen size as the div is jus
I was also thinking of media queries, but then I found this:
Just create a wrapper It will result in a This technique can also be coupled with media queries and a bit of ad hoc knowledge about page layout for even more finer-grained control. It's enough for my needs. Which might be enough for your needs too.padding-bottom, like this:
div {
width: 100%;
padding-bottom: 75%;
background:gold; /** <-- For the demo **/
}