Why calc function doesn't work in height with position relative, but work in witdh?
It works:
#div1 {
position: absolute;
left: 50px;
height: calc(100% - 100px);
border: 1px solid black;
background-color: yellow;
padding: 5px;
text-align: center;
}
It doesn't:
#div1 {
position: relative;
left: 50px;
height: calc(100% - 100px);
border: 1px solid black;
background-color: yellow;
padding: 5px;
text-align: center;
}
But it works too:
#div1 {
position: relative;
left: 50px;
width: calc(100% - 100px);
border: 1px solid black;
background-color: yellow;
padding: 5px;
text-align: center;
}
P.S.: Tested on https://www.w3schools.com/cssref/tryit.asp?filename=trycss_func_calc