The body tag behaves differently from regular block-level elements like div because of how browsers handle it by default. Normally, block-level elements only take up as much space as their content requires. For example, a div will only stretch as tall as its content unless you explicitly set its height.
However, the body tag is special. Even if it doesn't have any content, browsers automatically make it stretch to fill the entire height of the screen (or "viewport"). This happens because the body works together with the html tag, which by default also takes up the full height of the screen. This ensures that if you set a background color or image on the body, it will cover the whole screen, not just the area occupied by the content.You can read more about it here : https://www.w3schools.com/tags/tag_body.asp