CSS issue with "vh" unit of measure on mobile devices
41 views
Skip to first unread message
Charlie Veniot
unread,
Dec 11, 2022, 1:46:10 PM12/11/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Using "100 vh" for height of things in a web page is problematic on mobile devices, because mobile web browser menus (when they appear) take up display space (either at the top or the bottom) and push the "100 vh" part of a web page out of view.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Well, I don't know what makes the found solution I adopted not as good as the other ones. If you know of any flaw in it, please advise.
I'll keep your other references in mind if I run into problems. Thanks!
Télumire
unread,
Dec 11, 2022, 3:45:46 PM12/11/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Well in your particular use case it works sure, but as pointed out on the stack overflow article you linked to, writing
height: calc(100vh - calc(100vh - 100%))
Is the same as writing
height: 100%
Because it translates to 100vh - 100vh + 100%. In order to be able to use height: 100%,
you must propagate that height from the root element through all the
children till the target element. Sometimes it may be too difficult. A more general/reliable solution
is the javascript approach I mentioned in my post.