I'm trying to make a layout where my div's height is dependent to its width. Is this possible with CSS? So far I haven't been able able to get it right. This might be easy I don't know; my strong suit is not CSS. Some help is appreciated.
Here is what I have:
body{
margin: 0;
box-sizing: border-box;
}
.mainContainer{
background-color: lightblue;
display: flex;
flex-wrap: wrap;
}
.cover{
display: inline-block;
width: calc(100%/3); /*this sets the divs widths to be a third of the screen */
/* height: ????; <--- Here is the issue how to set this so that it is 130% of whatever the computed width is? */
}
<div class="mainContainer">
<div class="cover" style="background-color: red;">Cover 1 Here</div>
<div class="cover" style="background-color: blue;">Cover 2 Here</div>
<div class="cover" style="background-color: green;">Cover 3 Here</div>
<div class="cover" style="background-color: yellow;">Cover 4 Here</div>
</div>