You can adjust the font size depending on content's length to make the text fit a div. You could use JavaScript to get the contnent's lenght. Whit it you can calculate the width.
But be aware that the letters have different widths (www takes more place than iii). You could overcome this by using font-family:monospace
.
Here's an example:
var cntnr = document.getElementById('container');
var lngth = cntnr.textContent.length;
var fntsz = 90 / lngth;
cntnr.style.fontSize = fntsz + 'vw';
#container {
width: 50vw;
font-family: monospace;
background-color: #efefef;
text-align: center;
}
<div id="container">Hello World!</div>
Another drawback is that you loose control over the height. E.g. if there's only a single letter, it will be huge.