I am trying to resize a text that is inside a div, like this example.
When i resize the div, also the font-size must be resized.
I try to set the text element with pure css with all the relative length units, but doesn't work. The font-size must be depends only by div size (so vw is not appropriate). The only alternative that I think is set font-size by javascript.
<style>
div {
border: 2px solid;
padding: 20px;
width: 300px;
resize: both;
overflow: auto;
}
</style>
<div>
<p style="font-size: 2rem">Hello World</p>
</div>
Which is the best way, preferably in bootstrap 4 or pure css ?