0

Isn't the height and width of<body> element same as the viewport's height and width?

22nd Aug 2025, 9:59 AM
Golu Kumar
2 ответов
+ 2
not necessarily. browsers often apply a default margin or padding, so the body width is actually smaller than the viewport width. and the height is 0 if the body is empty. that's why we often use css reset to start everything at a predictable default. https://sololearn.com/compiler-playground/WXmhoUrJJolF/?ref=app
22nd Aug 2025, 10:29 AM
Bob_Li
Bob_Li - avatar
+ 1
Thank you Bob
22nd Aug 2025, 12:44 PM
Golu Kumar