You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-values-4] viewport units vs initial containing block #6453
How does (or doesn't) the initial containing block correspond to the various viewport units? Are there any units for which html { height: 100%; } = html { height: 100*vh; } ?
Blink, WebKit, and Gecko have consistent behavior:
ICB is the small viewport size
abspos containing block is the small viewport size
fixpos containing block is the layout viewport (aka dynamic viewport size)
small/dynamic/viewport all work as expected - large overflows the viewport at first, but is the size of the viewport after the URL bar hides. Dynamic matches svh until the URL bar hides, at which point it snaps to matching lvh.
Note: Firefox on iOS is a little broken; it treats all the viewport units as svh, never changing them as the URL bar hides. It does still resize the fixpos containing block, tho.
Proposal: Spec the current interoperable behavior: that the ICB matches the small viewport, but the fixedpos containing block matches the dynamic viewport.
The CSS Working Group just discussed [css-values-4] viewport units vs initial containing block, and agreed to the following:
RESOLVED: We define relationship between ICB, abspos, and fixedpos and viewport size as detailed in the comment
The full IRC log of that discussion
<dael> TabAtkins: There was some certain screen sized things related to ach other. ICB, viewport units, and fixedpos cb.
<dael> TabAtkins: Appears there is almost perfect consistency. There wasn't a few years back, but have converged with one exception.
<dael> TabAtkins: Suggest we spec. ICB is small viewport size. abspos cb that you get if you have abspos relative to no element is also small viewport size. fixedpos if the layout viewport which is the dynamic viewport size
<dael> TabAtkins: That's the proposal. ICB is small viewport. fixedpos matches dynamic viewport
<dael> astearns: How is FF on iOS differing from Safari when they use same engine?
<dael> TabAtkins: That's a great question and we don't know, but it was definitely doing that. We have no idea. But browsers showed different behavior for this test case.
<smfr_> There is some WKWebView and UIScrollView inset stuff that can affect this behavior, and they are controllable by the app
<dael> astearns: Okay defining all these relationships. I assume we should have WPTs as well
<dael> TabAtkins: Yep. We'll verify that there is
<dael> astearns: And smfr_ in chat gave us a possibility for why the difference
<dael> TabAtkins: Yes, I thought the web rect might be effecting it.
<TabAtkins> s/the web/stuff outside the web/
<smfr_> no concerns
<dael> astearns: Prop: We deinfe relationship between ICB, abspos, and fixedpos and viewport size as detailed in the comment
<dael> astearns: Obj?
<dael> RESOLVED: We define relationship between ICB, abspos, and fixedpos and viewport size as detailed in the comment
Activity
gsnedders commentedon Nov 29, 2021
is this not a dupe of #5218 and #5777?
flackr commentedon Jun 20, 2022
On experimentation it looks like
html { height: 100%; }=html { height: 100svh; }. Demo at https://flackr.github.io/web-demos/viewport/units/ showing each of the equivalent heights.bramus commentedon Jun 21, 2022
Notes from talking to @bokand about this some time last week
Visualisation:
html { height: 100%; width: 100%; }#fixed { position: absolute; height: 100%; width: 100%; }The units can be derived as such:
svhunit = height of ICBlvhunit = height of ICB + height of extra bars (top/bottom bar)vhunit = free for interpretation as per spec, yet all browsers seem to have settled on setting it equal tolvhtabatkins commentedon Oct 27, 2023
Quick test to show off the viewport -> unit correspondence: https://xanthir.com/etc/tests/viewports/
Blink, WebKit, and Gecko have consistent behavior:
Note: Firefox on iOS is a little broken; it treats all the viewport units as svh, never changing them as the URL bar hides. It does still resize the fixpos containing block, tho.
Proposal: Spec the current interoperable behavior: that the ICB matches the small viewport, but the fixedpos containing block matches the dynamic viewport.
tabatkins commentedon Oct 27, 2023
(This should close #5218, #8410)
css-meeting-bot commentedon Nov 1, 2023
The CSS Working Group just discussed
[css-values-4] viewport units vs initial containing block, and agreed to the following:RESOLVED: We define relationship between ICB, abspos, and fixedpos and viewport size as detailed in the commentThe full IRC log of that discussion
<dael> TabAtkins: There was some certain screen sized things related to ach other. ICB, viewport units, and fixedpos cb.<dael> TabAtkins: Appears there is almost perfect consistency. There wasn't a few years back, but have converged with one exception.
<dael> TabAtkins: Suggest we spec. ICB is small viewport size. abspos cb that you get if you have abspos relative to no element is also small viewport size. fixedpos if the layout viewport which is the dynamic viewport size
<dael> TabAtkins: That's the proposal. ICB is small viewport. fixedpos matches dynamic viewport
<dael> astearns: How is FF on iOS differing from Safari when they use same engine?
<dael> TabAtkins: That's a great question and we don't know, but it was definitely doing that. We have no idea. But browsers showed different behavior for this test case.
<smfr_> There is some WKWebView and UIScrollView inset stuff that can affect this behavior, and they are controllable by the app
<dael> astearns: Okay defining all these relationships. I assume we should have WPTs as well
<dael> TabAtkins: Yep. We'll verify that there is
<dael> astearns: And smfr_ in chat gave us a possibility for why the difference
<dael> TabAtkins: Yes, I thought the web rect might be effecting it.
<TabAtkins> s/the web/stuff outside the web/
<smfr_> no concerns
<dael> astearns: Prop: We deinfe relationship between ICB, abspos, and fixedpos and viewport size as detailed in the comment
<dael> astearns: Obj?
<dael> RESOLVED: We define relationship between ICB, abspos, and fixedpos and viewport size as detailed in the comment
[css-display-3] Clarify that ICB is small viewport size. #6453
[css-position-3] Clarify that fixedpos CB is layout viewport. #6453