In CSS, for example this code:
<html>
<head>
<style>
* {
box-sizing:border-box;
}
.container {
height:100px;
width:400px;
}
</style>
</head>
<body>
<button id="click" />
<div class="container">
<p id="text" ></p>
</div>
</body>
<script>
Some function() {
//code that adds 'text' to the paragraph every click
}
Some another function() {
Some if(text extends to the width of the parent, then lower the font-size) {
}
}
</script>
</html>
How do I make the font-size smaller and smaller if its width extends? Like for every click of the button adds 'text' on the paragraph, so when I repeat it many times, It would be like: texttexttexttexttext and so on, if it extends then lower the font size