-
Notifications
You must be signed in to change notification settings - Fork 748
Description
https://drafts.csswg.org/css-overflow-3/#overflow-propagation
UAs must apply the
overflow-*
values set on the root element to the viewport when the root element’sdisplay
value is notnone
. However, when the root element is an [HTML]<html>
element (including XML syntax for HTML) whoseoverflow
value isvisible
(in both axes), and that element has as a child a<body>
element whosedisplay
value is also notnone
, user agents must instead apply theoverflow-*
values of the first such child element to the viewport.
The spec is clear that we don't propagate from the root element in that case.
The spec could be interpreted as still allowing to propagate from the <body>
(being in a display: none
subtree doesn't mean that it has display: none
itself), but no browser does that, as seen here:
<!DOCTYPE html>
<html style="display: none">
<style>
::-webkit-scrollbar { background-color: #eff0f1; width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #898c8d }
</style>
<body style="overflow: scroll">
Regardless, if both the root and the body have display: none
, the spec is clear that we don't propagate from either of them.
So what overflow
does the viewport use?
The obvious choice is the initial overflow: visible
, which will behave as auto
:
If visible is applied to the viewport, it must be interpreted as auto.
Since there is no box, it's hard to tell if browsers are using visible
/auto
or clip
/hidden
. Nobody uses scroll
, though.