The element is <div>by default a block level; it occupies the entire space of its parent container, which in this case <body>.
You can set the value #wrap {display: inline-block;}or #wrap {display: table;}so that it flows with the surrounding content.
#wrap {width: fit-content;), . .