The Large, Small, and Dynamic Viewports

There are some changes being proposed regarding viewport units, finally solving that “100vh in Safari on iOS” issue …


This content originally appeared on Bram.us and was authored by Bramus!

There are some changes being proposed regarding viewport units. The additions — which have already landed in the editor’s draft — define several viewport sizes: the Large, Small, and Dynamic Viewport.

Thanks to these additions we will finally be able to solve that “100vh in Safari on iOS” issue.

~

Table of Contents

  1. The Large, Small, and Dynamic Viewports

  2. The catch
  3. Going Logical
  4. In Closing

~

# The Large, Small, and Dynamic Viewports

# The Large Viewport

The Large Viewport is the viewport sized assuming any UA interfaces (such as the address bar) that are dynamically expanded and retracted to be *retracted*. It has no prefix, so you use vh / vw / vmin / vmax like before.

# The Small Viewport

The Small Viewport is the viewport sized assuming any UA interfaces that are dynamically expanded and retracted to be *expanded*. It has the s-prefix, so units are svh / svw / svmin / svmax.

# The Dynamic Viewport

The Dynamic Viewport is the viewport sized with *dynamic consideration of any UA interfaces*. Its prefix is d, so the units are dvh / dvw / dvmin / dvmax.

? You’ll want these Dynamic Viewport Units to have a UI that auto-stretches as the UA interface changes: the value will be anything within the limits of 100vh (maximum) and 100svh (minimum).

~

# The catch

Note that it’s totally up to the UA (browser) to implement a behavior for the Dynamic Viewport. Some browsers may update directly the interface changes, or only after a while … the spec is fine with that.

The UA is not required to animate the dynamic viewport-percentage units while expanding and retracting any relevant interfaces, and may instead calculate the units as if the relevant interface was fully expanded or retracted during the UI animation.

Above that things like on-screen keyboards are not taken into account. For that we have the upcoming Virtual Keyboard API.

~

# Going Logical

Additionally the spec now also defines logical units, and thus talks about vi/dvi/svi and vb/dvb/svb which are the inline and block size respectively of the large/dynamic/small viewport. A small but very welcome addition.

~

# In Closing

It feels great to see things move in this area I must say, as the reported WebKit bug dates back from 2015, and the relevant CSSWG Issue from 2019.

I hope that a final consensus on these viewport additions can be reached soon, and that the upcoming Safari 15 — which alters the viewport extensively as you scroll up/down — will make work to include these additions on top of their already supported env(safe-area-inset-*) values.

~

To help spread the contents of this post, feel free to retweet the announcement tweet:

~

Follow @bramus (= me, the author) and/or @bramusblog (= the feed of this blog) on Twitter to stay-up-to date with future posts. RSS also available.

? This post originally was a set of tweets.


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2021-07-07T22:07:44+00:00) The Large, Small, and Dynamic Viewports. Retrieved from https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/

MLA
" » The Large, Small, and Dynamic Viewports." Bramus! | Sciencx - Wednesday July 7, 2021, https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/
HARVARD
Bramus! | Sciencx Wednesday July 7, 2021 » The Large, Small, and Dynamic Viewports., viewed ,<https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/>
VANCOUVER
Bramus! | Sciencx - » The Large, Small, and Dynamic Viewports. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/
CHICAGO
" » The Large, Small, and Dynamic Viewports." Bramus! | Sciencx - Accessed . https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/
IEEE
" » The Large, Small, and Dynamic Viewports." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/. [Accessed: ]
rf:citation
» The Large, Small, and Dynamic Viewports | Bramus! | Sciencx | https://www.scien.cx/2021/07/07/the-large-small-and-dynamic-viewports/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.