<!DOCTYPE html>
<body>
    <div style="border: 1px solid green; width: -moz-fit-content">Some text</div>
    <div style="border: 1px solid green; width: -moz-fit-content">Some text</div>
</body>