-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-values-4] Add vhc value #4329
Comments
Another article that advocates for avoiding vh units completely because of this problem: https://chanind.github.io/javascript/2019/09/28/avoid-100vh-on-mobile-web.html |
Agenda+ to make everyone read the article linked above. This is bad and we should do something about it; I'm less sure about what. |
Is this behavior ever useful? Should it not be the case that if the size of the viewport changes, by way of scrollbars or due to browser chrome appearing, the size of the initial containing block changes. Or is there something special about this URL bar? |
Agreed! As noted, my proposal doesn’t really solve the issue, but it does at least offer choice and perhaps a better default than how vh currently behaves. But if someone comes up with a solution that makes the vh unit itself useful again I would be all for it!
That’s actually how vh units initially behaved! But it turns out that it’s a horrible UX because content would actually move/change size as you scrolled. So Safari (and later Chrome) both agreed that just fixing it to a single height would be the better UX - feel free to take a look at the two citations in my first paragraph. |
I'm thinking that the issue is that we really need a good default for |
Agreed; I would love for vh to be useful again.
Yeah, I think it has unfortunately. There have been issues opened for both browsers for years and all have been closed saying the current behavior is intentional. |
But nothing stops |
Further question: should it respond to on-screen-keyboard showing/hiding? I suspect the answer is no, but I'm not sure what answer is most consistent. |
I would say that yes, any feature for adjusting to URL bar show/hide behavior should also include the keyboard and any other pop-up/pop-over browser widgets that cover part of the layout viewport. Example use case: if the UI consists mostly of a large text box, it's nice to make that fill most of the window. It's less nice if the box gets covered up by the keyboard you're using to type in it, and you end up with a scrolling text box inside a scrolling window. An alternative to adding new units would be to expose environment variables for the size of the obscured region on each side of the screen. Or maybe, include this type of obscuring in the "safe inset area" variables that are already defined. |
sorry, can you clarify what you mean by this? Are you proposed that If so, I don't think that is a better solution than the current situation -- that's how it behaved originally and it was a worse experience than what we have now. :) (If not, sorry, can you explain what you mean? I apologize)
I think that would put us back at the original behavior of |
Hm, I'm confused then. In what situations would it be worse? Naively, I'd think that it's the best of both worlds, neither under- nor over-flowing regardless of how the chrome is displayed.
Ah, hm, is this the issue? It's really better to have something over or underflowing than have things possibly shift when the user scrolls? |
Correct! At least, that's what Safari and Chrome teams agreed as well. Here's a brief history of vh units:
So, that's how we got here -- |
Ah, I hadn't realized you wanted So there are three distinct use cases:
|
Seems like a great summary, yes! Thank you. I think everyone hoped that one css unit ( So I proposed an additional unit instead :D |
If the Also, I guess the units people really wants is the visual viewport size instead of the layout viewport. |
I initially argued that vh should reflect the minimum possible size but didn't get a response from WebKiters so decided that the larger size and compat with Safari was preferable to a saner default but incompatibility with Safari.
I don't think so. The visual viewport is conceptually detached from layout. i.e. if the user zooms in, the visual viewport shrinks. So we don't ever want layout to depend on visual viewport properties. I think having a new unit for the minimum possible size sounds fine, or exposing the browser chrome insets instead as @AmeliaBR mentioned (I think that's equivalent to this proposal) which might be easier to explain.
Chrome on Android today resizes the ICB when the keyboard comes in. I think it's a rather regrettable decision since resizing the ICB can take a long time - it's a significant source of making the mobile web feel janky. In addition, it's not uncommon to tap on an editable only for the resized layout to now obscure the box you're trying to type into. We've had success on ChromeOS using a model where the onscreen keyboard shrinks the visual viewport but leaves layout unchanged. Anecdotally this works much better: the user can still pan around the full viewport but the layout doesn't change at all when the keyboard comes up which works much better, especially on sites that didn't give much thought to onscreen keyboards. Unfortunately it's a difficult thing to bring to Android because of compat so we haven't been able to do it yet. |
My only concern with that is: does the size of the inset change as the UA chrome changes size? If so, that feels like we would actually just be back at the initial behavior of vh units, and we wouldn’t have solved anything. But if they remain the same value even as UA chrome resizes, then I think that’s a good alternative to a vhc unit |
though thinking about it, I'm curious how it would work. If there's 1 value that changes, then that's not good. If there are 2 values (e.g. something like For example: height: 100vhc; vs height: calc(100vh - env(inset-ua-chrome-small) + env(inset-ua-chrome-large)); If I'm understanding the proposed env variable correctly - but it's entirely possible I'm not, though. |
My recommendation would be the inset is a "collapsible height", i.e. how much the UA might expand as a result of scrolling. In this case, this would be the full URL bar height, regardless of whether that's showing. So the full height would be:
|
Ah ok, yeah, that’s not too bad. Personally I would prefer to use a vhc unit (easier understand and teach, and if you have to use that value itself in a calc then it is much simpler than having to do nested calcs - unless you then put it in an custom property or something) but I wouldn’t be opposed to it if that’s what’s decided is better. I also think you’ll find more developers using vhc (or equivalent) over vh so it would be nice if it were simple, but I have no hard evidence of that -- except for all the articles that say "avoid |
I was talking in slack with someone, and they proposed an alternative idea. What if the behavior of .container {
vh-sizing: expanded-viewport-height;
height: 100vh;
} with
(all of these are just placeholder names) With this pattern, the developer has options for all three use cases as noted by @AmeliaBR here, while also still being able to use I thought it was a novel enough idea, and the backwards and forwards compatibility aspect of it made it interesting enough for me to add here for feedback as well. |
My concern here is that as long as |
I agree; I think @bokand also mentioned that they (blink) would have preferred that to be the default here. Unfortunately, webkit adopted the opposite and now it's standard. I think in an ideal world we could change the default behavior of Which is why I find the solution I listed above compelling, because it is 100% backwards compatible while also allowing new functionality for devs that opt-in to the new behavior. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: Add vhc value<dael> github: https://github.com//issues/4329 <fantasai> https://chanind.github.io/javascript/2019/09/28/avoid-100vh-on-mobile-web.html <dael> fantasai: Topic is not add a vhc as much as it is solve the problem. Issues is that on mobile we have multiple notions of viewport. viewport units are defined in regards to viewport but on most browsers there's a disappearing address bar <dael> fantasai: To avoid content from constantly shifting have made that not respond to appear/disappear of address. Problems is deaults being impl makes viewport behavior where 100vh assumes address bar is not visible. THat's not initial state. <dael> fantasai: Lots of websites design to fit within visible are upon a page load or to have things visible/invisible upon load. Getting that things supposed to be on screen using vh are not visible due to changing height. <dael> fantasai: Need to solve the problem. Multiple options, could take multiple of them. <dael> fantasai: Want to hear what others thing <dael> AmeliaBR: Recap proposals from issue. 1 is don't add any new syntax but encourage any browser with the disappearing nav bar effect to size vh to value when chroma is visible. <dael> AmeliaBR: Sometimes you'l have more than 100vh visible but on initial load it will fit the screen. That's a guidance to UA without changing language <dael> AmeliaBR: Original posted suggested alternate unit proportional to the smaller viewport <dael> fantasai: Third is make the current vh unit to fit the initial load and then add a unit that allows author to take full height of viewport if they want. Inverse of the initial proposal <dael> fantasai: Problem with that is current keyword is the safer value <fantasai> s/Problem/Advantage/ <dael> AmeliaBR: Final option is to not add a unit and then add environment variables for disappearing effect so it's similar to inset variables <dael> florian: Another aspect to problem; it's not just the title, but appearance and disappearance of keyboard. Currently keyboard resizes viewport, but maybe that should only change visual viewport. That's a good idea, but title bar can't do that <dael> smfr: I don't htink we should derail with keyboard. What you described florian is iOS where it does not change layout height <dael> florian: If you think it's separate let's keep that out <dael> smfr: Did any proposals include a unit that changes value when chroma hides? vh that changes <dael> smfr: It's an option <dael> TabAtkins: From author feedback they do not want that becaues layout jiggle while it moves <dael> AmeliaBR: Doesn't behave nicely with things that disappear on scroll. For UX and rendering reasons. For other things like keyboard where it's more discrete it's reasonable. <dael> smfr: I'm all for avoiding layout jiggle. Seems that pages may be designed such that chrome disappears when you're at bottom <dael> florian: I think it would be weird to build a page that way <dael> jensimmons: This is something I've heard a lot, the sentements in this issue. Like many parts of CSS the loudest voices can be most negative. We shoudl work on this and give consideration for all use cases and not jump too quickly and not resolve quickly for what loudest voices say. I'd be happy to work on this and think it through. We need to think about how to animate if they want that. This is more complex. But we should tackle <jensimmons> +1 to everything should match <dael> smfr: Related all would match, 100vh, 100% body, window.innerHeight would all mean same thing. Currently don't. Don't know if they can but ti should be a goal <dael> smfr: Do we know if Andriod has a similar behavior to iOS where 100vh is the chrome hidden state? <dael> fantasai: Blink has 100vh and 100% on html body meaning different things. 100vh matches Safari. They would like 100% html match but that's currently being a work around for vh not considering address bar <dael> fantasai: One of the devs that worked on this in Blink said they wanted to argue for 100vh not including address bar but they had to match Safari <dael> AmeliaBR: Seems like WG took approach for UAs to fill in details and each browser took a different approach and it's not really working and we should come in and specify, but with a range of options for authors so they can do what they want <AmeliaBR> s/AmeliaBR/jensimmons / <dael> astearns: Anything else on this to discuss or do we have jensimmons work on the use cases to consider? <dael> fantasai: I'm happy to kick it to jensimmons to think. It's important and we should not drop, but we can talk later <dael> astearns: Anything else people want added to discussion? <dael> astearns: I think smfr list of things that should be eq is excellent <dael> AmeliaBR: Another option on issue was someone suggesting box sizing like property where authors choose what vh units are relative to. It's another thing to think of <dael> fantasai: Probably 2 pairs of units would be cleaner and less likely to result in accidental errors <dael> myles: 2 units might be better cause can use both at the same time. Mode switch you can't use both at same time <dael> AmeliaBR: Good arguments. <dbaron> Using both at the same time is probably very hard to do correctly, though. <dael> AmeliaBR: Lots of options and use cases. Getting through pros and cons for each sounds sensible <dael> astearns: Let's continue in GH. jensimmons I'll assign it to you? <dael> jensimmons: Okay <dael> astearns: We'll discuss again on the call when it's at a good point. |
I'm a fan of the new units, I think they make sense as spec'ed. I think the complaints I'm seeing about proliferation of CSS units are understandable, but they overlook the fact that today 100vh isn't useable on mobile without a bunch of additional work. However, I don't think this problem can be solved in a satisfactory way without also dealing with the visible viewport when the on-screen keyboard appears. Today iOS browsers display the on-screen keyboard over the bottom of the viewport, and Android/Chrome shrinks the viewport to appear above the keyboard. To provide a concrete example, if you were to define this CSS class using the proposed units: .bottomQuarter {
position: fixed;
top: 75dvh;
height: 25dvh;
width: 100vw;
} It would be hidden by the on-screen keyboard on iOS, and would appear above the keyboard on Android/Chrome. The same problem occurs if you define it using: .bottomQuarter {
position: fixed;
bottom: 0;
height: 25dvh;
width: 100vw;
} Or using units available today: .bottomQuarterish {
position: fixed;
bottom: 0;
height: 25vh;
width: 100vw;
} For additional background/sympathy: To workaround the browser chrome retraction and on-screen keyboard issues today I use the In short, for this to be useful, we also need something like |
There is the Virtual Keyboard API: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/VirtualKeyboardAPI/explainer.md |
Thank you @fabb - I hadn't seen that. The Virtual Keyboard API proposal looks excellent to me. My revised points are:
I think my previous example can be used to illustrate this. Consider an element that occupies the bottom quarter of the visible viewport, and that remains visible above browser chrome, and above the virtual keyboard. And, the Virtual Keyboard proposal and viewport relative lengths are in place. And, we want it to work on browsers that don't support the 2 new proposals. The CSS would look like this: .bottomQuarter {
position: fixed;
bottom: 0;
bottom: env(keyboard-inset-bottom, 0px);
width: 100vw;
width: 100dvw;
height: 25vh;
height: calc(25dvh - env(keyboard-inset-height, 0px)/4);
} I think this CSS is fine, but there's a case for adding environment variables for browser chrome offsets too. We will hopefully have environment variables for safe areas, virtual keyboard borders, and foldable device screens; for completeness it seems like collapsing browser chrome offsets should be added. |
It is so good to se progress on this issue. Thank you! The floating browser chrome of Safari 15 might introduce some new complexity. There is some ambiguity towards what could be considered the large and the small viewport. There are suddenly not two but three sizes that are of interest: When browser chrome is floating:
When browser chrome is collapsed in the bottom:
I would expect the large viewport to be the area behind the floating chrome. If I were to use the units to size images to fill the entire screen, this is the area I want to fill, even though there is browser chrome floating above. The small viewport though, would that be the area above the floating chrome (the smallest area), or the area when the browser chrome is collapsed at the bottom of the screen? |
@johannesodland it seems the webkit team is currently toggling the value of |
They seem to toggle both When browser chrome is floating When browser chrome is collapsed at bottom There are essentially three sizes here: I can se a few issues here: Fixed and stable Defining the large viewport The issue here is that with Safari 15 you now get the largest viewport when the UA interfaces are expanded and floating above the viewport, not when it is retracted. It's the opposite of most current mobile browsers. Defining the small viewport The smallest area where nothing is obscured is the area above the floating interface. If It could be more sensible to map I think the spec might have to deal with floating UA interfaces. A also believe that is needs to address that the viewport can be at its largest when UA interfaces are visible, and the smallest when UA interfaces are retracted. This is the complete opposite of how it is in most browsers now. |
Since iOS Safari seems to have changed in a way that won't comply with these new spec changes and I just remembered that smart banners possibly affect viewport units, we might need some webkit eyes on this? @smfr? |
@jensimmons could potentially also provide some insight as well? |
I wanted to see for myself and verify what @johannesodland posted above, and here are my thoughts/observations (that are mostly just a rehash of what Johannes said above): Using this page as a playground https://codepen.io/afrehner/full/MWmyZEq and having downloaded the XCode 13 beta in order to get access to the mobile version of iOS 15's Safari, I was able to take this video: iOS15-vh.movObservations:
Essentially, Safari is now treating I think, more than anything, this emphasizes the importance of getting the |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: Values and Units L4<TabAtkins> ScribeNick: TabAtkins <fantasai> github: https://github.com//issues/4329#issuecomment-863677668 <TabAtkins> fantasai: Tab and I comitted the changes for our earlier resolution on these joint issues (this and next) <fantasai> https://github.com//issues/6113 <Rossen_> q <TabAtkins> fantasai: we resolved to add viewport units to represent the "small" and "dynamic" viewport <TabAtkins> fantasai: there are a couple open qustions still <TabAtkins> fantasai: One was whether dynamic should be a unit or an env() <TabAtkins> fantasai: We went for unit based on comments from Rachel Andrews that it would be easier to teach <TabAtkins> fantasai: Main reason for env() was to deliberately make it more awkward to use. <TabAtkins> fantasai: Right now tho, the draft is using units; we can reopen that discussion if people wish <TabAtkins> fantasai: Other question is we have an unprefixed set of units (vw/etc) and two prefixed sets (svw/etc, dvw/etc) <TabAtkins> fantasai: Do we want an explicit set of "larger" prefixed units for symmetry? <TabAtkins> fantasai: And if we do that, should we allow the unprefixed values to do something smarter? Right now they're the larger viewport, but this causes some troubles and browsers might want to do something smarter. <TabAtkins> fantasai: So do we want to give CSS some flexibility for the unprefixed units? <TabAtkins> fantasai: So first quesiton to tackle: anyone want us to switch the dynamic units to being an env()? <TabAtkins> jensimmons: I think it works well as a unit. Authors will need and use it, and having it be the same as the other units will make it much easier to use. <florian> +1 <miriam> +1 <rachelandrew> +1 <TabAtkins> Rossen_: Do we ahve a particularly well-defined guidance on how and when to add value types vs env()? It woudl be unfortunate if we end up in a situation where scrollbar-width is in an env() but viewport-width is in a unit, etc <TabAtkins> fantasai: We don't have this written down, but the basic principle is if you're likely to want multiples of this other than 1. <TabAtkins> fantasai: Like for safe-area-inset, you don't want 30% of it, or 5x that. <TabAtkins> fantasai: You might add some more length to it, some extra px or something, but very unlikely to want to multiply it by a number. <TabAtkins> fantasai: But for viewport units it's very common to want 50vh/etc, so it makes more sense to be a unit where it's easier to do that <TabAtkins> Rossen_: I can see how this could make sense from a usage pov <TabAtkins> Rossen_: At the same time I could argue the inset should be a unit regardless of whether you'd want it to be x1 or not <TabAtkins> florian: Other factor is if the value depends on where you are in the tree, it must be a unit. If it doesn't, either works. <TabAtkins> florian: For example, width of scrollbars cannot be an env() because it changes based on the unit you're applying it to. <TabAtkins> emilio: Having units depend on computed values of properties is kinda sketchy... <TabAtkins> florian: Sure, but still like having font-size expressed in an env() doesn't make sense, so you need em <bmathwig> width of scrollbars can't change depending on element, it's fixed in most UA implementations <TabAtkins> emilio: Sure, tho there's only two scrollbar widths. Could still be done as two env()s <TabAtkins> plinss: I don't feel too strongly, but I'm a little concerned about proliferation of units. <florian> bmathwig, see https://drafts.csswg.org/css-scrollbars/#scrollbar-width <TabAtkins> plinss: If the non-unit syntax ends up unwieldy, we can work on that. <TabAtkins> Rossen_: Basically same for me. I'd also like us to formulate a more general reasoning for when to use units vs env() <bmathwig> auto | thin | none only applies to classical scrollbars and not overlay scrollbars that have zero-width in layout computations <TabAtkins> Rossen_: But overall I don't object. <bmathwig> Blink is moving towards overlay scrollbars on Windows in the next few months <TabAtkins> fantasai: Okay so it sounds like we should resolve on dvh being units <fantasai> bmathwig, that doesn't change the matter of the width of the scrollbar, only how much space it takes up in layout <TabAtkins> RESOLVED: "dynamic" viewport does indeed use units, not env() <TabAtkins> fantasai: So next is about unprefixed units. <TabAtkins> fantasai: Do we want an explicit large-prefixed set to go with the others? <TabAtkins> jensimmons: been a lot of convo on WK team last week about how these work <TabAtkins> jensimmons: We feel very strongly there should be an lvh unit <TabAtkins> jensimmons: And the vh unit should no longer be defined as longest length; it should instead be something more flexible that the UA can decide on based on what they're doing with their particular browser <bmathwig> fantasai, very true <lea> I'm all up for making vw/vh more useful, but how web compatible is this change? <TabAtkins> florian: I see why you'd want the flexibility for this, to provide best UX possible, I'm concerned about variance in behavior that would cause content to be off-screen in one browser, etc. <TabAtkins> fantasai: tbf that's already happening today <TabAtkins> jensimmons: Lea made a comment about webcompat, that's absolutely a concern <lea> q? <TabAtkins> jensimmons: I think having this be flexible so UA can make the best decision to present the fewest compat problems <TabAtkins> jensimmons: And by giving authors the explicit lvh and others let them choose the right one for their website <florian> I'm sold :) <lea> +1 for this change from me <TabAtkins> jensimmons: But browsers may need flexibility to redefine that vh itself based on individual pages <fantasai> +1 from me also <TabAtkins> emilio: I think any change to vh should probably be a [...? missed] <TabAtkins> emilio: I think we want a definition in the spec we can implement interoperably <emilio> s/be a ?/ consider compat, but... <TabAtkins> fantasai: So I think we have agreement to add "large" viewport units, make vh/etc ambiguous at the moment (and gradually make it clear what this actually means) <TabAtkins> fantasai: So for now we say it's UA-defined and it must fall in the range of svh and lvh <TabAtkins> florian: Also a note that if any UA uses the flexibility to make it something other than the three explicit ones, come back to the group and spec it <TabAtkins> emilio: Can we file an issue to explore the compat of vh/etc? <TabAtkins> fantasai: We should also have an issue about what is the ICB in these cases, and that's probably the same <florian> s/and spec it/so that we can see if it is something we could spec/ <fantasai> s/probably the same/probably should be the same as the unprefixed units/ <TabAtkins> jensimmons: I noticed in the discussion there was some discussion about the "l" standing for "layout viewport", but I like it better to be "longest" <florian> +1 to s/d/l as the naming <TabAtkins> fantasai: Earlier we were thinking we'd use an "l" prefix for the dynamic one. Now we're gonna do small/large for s/l, or short/long, whichever you prefer to talk about <TabAtkins> RESOLVED: Add lvh as explicit "large viewport" unit <TabAtkins> astearns: So second is about redefining vh <TabAtkins> fantasai: Currently the spec is actually extremely vague <TabAtkins> fantasai: it just says "it's the size of the viewport" <TabAtkins> fantasai: So the resolution here would be to maintain the ambiguity <TabAtkins> florian: Maintain ambiguity or explicitly say it's UA-defined? <TabAtkins> fantasai: I'm fine with either <TabAtkins> florian: I'd prefer UA-defined with the note i said earlier <TabAtkins> florian: About UAs reporting to the WG if they do somethign creative <TabAtkins> astearns: Any objections? <fantasai> scribe+ TabAtkins <TabAtkins> RESOLVED: vh/etc are deliberately UA-defined <TabAtkins> fantasai: That should be it for this issue, tho we need to open that issue about the nuances of vh <TabAtkins> astearns: I'd encourage people to file new issues for any further discussions, these issues got long and intertwined and it'll be easier with new issues |
Thank you to everyone expressing interest in and concern about what Safari for iOS15 is going to do. Yes, in the first few betas Safari was experimenting with changing |
@jensimmons Glad to see it's on the radar at the Safari team. I do hope that you will stay in touch and collaborate with the people behind other browsers to come to very consistent, standardised implementation in all browsers. This whole issue was created because some browsers showed unexpected behavior when using 100vh compared to others. It would be a such a shame if all these years of struggle, discussions, finding hacks to make things work cross-browser and now finally introducing additional units to really fix the issue, if afterwards behavior still isn't the same across the board. That would be such a waste of time and effort. This should not really be about Apple's individual opinion but please make this a united decision. Only then these units have a real purpose, otherwise I'm afraid we might as well throw all of this in the bin, while we are so close to a solution. :) |
When the issue/PR about the changes to Thanks, and it's great to see this resolved! |
Alright, officially published the 4-way v*/sv*/lv*/dv* spec at Opened two issues for follow-up discussion: #6454 about enforcing v* as a static unit, and #6453 about the relationship with the actual initial containing block. We also have #6026 open about scrollbars. |
The CSSWG resolved to close this issue and open new separate issues on anything else that needs to be discussed. It's been a great debate, but now this ticket has far too much going on, and it's not possible to keep up with the ideas. File new separate tickets about each detail / debate, and we can discuss there. As per the CSSWG's way of using issues. Thanks everyone! |
To keep track of such issues, use And to talk about things that should be environment variables, use And if you aren't sure whether it should be a unit or environment variable — put the more likely choice in the title, and label it with both labels. See you in the other issues. |
Latest info
Added
lvh
,svh
,dvh
,lvw
,svw
, anddvw
units.See #4329 (comment) and #4329 (comment) for more details. 🎉
Original content below:
Background
vh
is defined asEqual to 1% of the height of the initial containing block.
Perhaps the current behaviour 1 2 could also be defined asIn other words, on devices where the browser chrome changes size (e.g. mobile devices),
100vh
is actually larger than the viewport when the browser chrome is maximized, and thus overflows.A brief history of the
vh
unit is outlined here #4329 (comment)Proposal
vhc
(c = "with chrome", but it could be something else) could be defined asOn devices without a changing chrome size (e.g. desktop devices),
1vh === 1vhc
.Advantages and Drawbacks
Pros and Cons list for each proposal
Original content of this section:
A drawback of
vh
units is that content will be cut off when (1) you load a page and (2) when you scroll upwards, while the content fits when you scroll down and the chrome is minimized.The
vhc
unit would be the inverse: content would fit the page when (1) you load the page and (2) when you scroll upwards, but you would see additional content (or whitespace, depending on the implementation) when the chrome is minimized.It also would provide a better experience than
vh
for games and other full-screen content that doesn't or shouldn't scroll at all.In the end, this proposal does not completely solve the issue of
1vh
needing to be different values at different times. However, it does at least give the developer a choice in which value that they want to use.(For what it's worth, my personal preference is that I would end up using
vhc
units for responsive designs, because I would rather have additional content visible or some whitespace added, rather than have content cut off and not visible.)Alternative Proposals
And a breakdown of the pros and cons of each proposal so far
Current Workarounds
As it stands, web developers that want to have a full-height website are either reliant on javascript 1 2 3 to get
vh
units to not cut off content, or just tend to avoid 1 usingvh
units altogether.Unrelated
This is my first time proposing, so if I did something wrong or need to improve something please let me know! Thank you for your patience. :)
The text was updated successfully, but these errors were encountered: