Overview
In general 100% height is required when the design requires full height.
As an example a typical situation is to position the footer on the bottom, regardless of the screen's height. While developing these design concepts, lacking 100% height shows clear issues when dealing with empty pages, where no content is generating height and as a result, the footer is stacked below the header.
Design concepts that introduce height requirements:
- fixed footer
- centered content vertically
- modal UI backdrop
- scrolling enhancements
- …
These concepts usually only affect the CSS of your website and require the functionality to be both on the html and body tag.
Back to question
So the question remains, why only on the <html />
or only the <body />
?
My idea is it depends on certain JavaScript calculations.
Imagine you require the top position of an element => document
object is used
Imagine you require to scroll to a certain position => window
object is used
Both functionalities can work separately where document
object finds elements in the <body />
and window
object finds properties on the <html />
tag.
Not entirely certain it's split this way, but I can see someone adding h-100
class to the html tag to fix a scrolling issue and someone else adding h-100
to the body to fix an offset/position issue. In my opinion it's always better to introduce height 100% for both.