From the spec's definition for background-size
:
A percentage is relative to the background positioning area.
And from section 3.11.1 (emphasis mine):
3.11.1. The Canvas Background and the Root Element
The background of the root element becomes the background of the canvas and its background painting area extends to cover the entire canvas. However, any images are sized and positioned relative to the root element as if they were painted for that element alone. (In other words, the background positioning area is determined as for the root element.) The root element does not paint this background again, i.e., the used value of its background is transparent.
You're applying the background to body
, but that makes no difference; section 3.11.2 simply says "the propagated values are treated as if they were specified on the root element."
So it looks like Firefox has simply updated its behavior to be more standards-compliant (I don't know if a Bugzilla ticket exists for this; I haven't been able to find one). The background positioning area of the root element in an empty HTML document in standards mode should be zero, since the height of the root element in such a document should be zero, meaning percentage values of background-size
should resolve to zero. Firefox 52 still appears to enforce an 8-pixel minimum height on the root element for some reason, resulting in the very narrow band that you see with background-size: 100% 100%
, but I guess that is a separate issue.
So basically this means in order for background-size: 100%
to work on either html
or body
, you need to specify 100% height for the root element, in a similar vein to my answer to height: 100% or min-height: 100% for html and body elements? (except the min-height
on body
is not necessary since you're only applying a single background, to the body
element alone, which is subject to the propagating behavior described in ยง3.11.2)
Or you can choose to apply min-height: 100vh
to the body
element instead as Michael Coker demonstrates, but that's assuming you're going to remove the default margins while you're at it.