An age old question, and one that you’ll get a multitude of answers to. It’s also the reason we have Flexbox and Grids, since in native form, CSS takes quite a beating (as in the layout author).
The document will flow where it can and stretch all the vertical limits it needs to. Horizontal is easy to control. Set the width, and Bob’s your uncle. Height is not such an easy thing to regulate, though we do have overflow fallback if a container has a set height.
We’ve brought down a document of indeterminant size and are expected to render it, by whatever style configurations we may have contrived.
It’s like a bucket of paint that we throw at the browser and let it sort out which pixels get it. Only we do help it along by structuring and directing presentation.