<style>
.grow-with-content { min-width: 200px; width: fit-content; }
</style>
<body>
<div class="grow-with-content" contenteditable="true">
The quick brown fox jumped over the lazy dog.
</div>
</body>
<!--
also works if you're doing plain css code and you have it linked to html
-->