How elements take up space on the page is controlled by their display. There used to be two broad display types in CSS: elements were inline or block-level but there's a bit more to it than that.
display
See All 35 Episodes of "AtoZ CSS"