Make the NON self-stretched division to the thickness of the container

My question is simple:

Can you stop a div from auto-stretching to the width of its containing element and have it only stretch horizontally as much as the content inside it forces?

Kind of like the default vertical behavior of divs but applied horizontally. Is this possible?

You'd have to set the display property to inline-block

<div style="display: inline-block">Text</div>