Is there any way in pure CSS to achieve having any property able to be a percentage of it's parent element height/width?
The below snippet I've set #b font-size to 20vh, however the goal is to have the font-size of #b always stay as half of the parent elements height as the container will be resizeable. Something like font-size: 50ph for parent height.
If not I will resort to using the ResizeObserver
#a {
height: 40vh;
display: flex;
background-color: coral;
justify-content: center;
align-items: center;
}
#b {
font-size: 20vh;
}
<div id="a">
<div id="b">Text</div>
</div>