'Responsive Font-Size (vary size using word size)

I'm trying to make the words always occupy 90% of the space of a box, but the problem arises when I don't know the size of these words, as they will be written by the user and taken from the DB.

How do I make a first name always take up 90% of 300px, for example?

<style>
.box{width:300px}
.txt{font-size:90%} /* HERE IS THE QUESTION*/
</style>
<div class="box">
<span class="txt"><?php echo $r['txt_db']; ?></span>
</div>

I found something about it, but nothing definitive, just improvisations that have many flaws.

css


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source