-
Notifications
You must be signed in to change notification settings - Fork 114
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
height 100% or 100vh on body & html? #70
Comments
I tend to use the latter ( |
In this context maybe |
Probably it is not necessary to set it on the |
Cross-referencing w3c/csswg-drafts#4329 in regards to #70 (comment). Edit: html {
height: -webkit-fill-available; /* https://twitter.com/bfgeek/status/1262465912025698304 */
}
html, body {
min-height: 100%; /* We keep this right? */
min-height: 100vh;
min-height: -webkit-fill-available; /* We want the vendor-prefixed value to take affect
in browsers that support it, fall back to 100vh,
then 100%. */
} |
I would love to see this approach implemented as a remedy. It seems to adapt content of any size, and would progressively enhance the user experience on mobile devices. Sticky footers would be a breeze to implement with these additions. |
Now there is a PostCSS plugin written for the purpose, which avoids applying the fix in Chrome. @jensimmons I hope you are on the path of recovery from COVID-19 and will get better soon. Take care of your health first, I wish you all the best! |
First comment on GH, but recently ran into issues of html and body having 0px height no matter what fix I used (including height:100%, height:auto, height:100vh, clear fixes, zeroed margin and padding, etc. etc.). I am relatively new to web dev. I was looking for solutions online to my problem and found this conversation and wanted to share my troubleshooting approach as it seems to loosely apply to this scenario. While inspecting elements, make note of the dimensions that show on hover as you move along the elements in your HTML (I am using FF dev tools included with the browser). The next element past the html and body that shows full height of the document is likely your problem, especially if it contains all other elements. My page had a tiled svg pattern and many CSS rules applied to that element. Additionally, all other elements were children of this background div. The problematic rule that solved my problem was having position:absolute in there. Once that was removed, the html and body automatically took on the full height of all the other elements combined. I am assuming that the absolute positioning took everything out of the flow/ height calculations in the DOM? Anyhow, hope this helps others that may have the same issue. This applies to the original issue as you might have container elements/divs as direct children of the body that have absolute positioning that is shortening your html or body height. |
Browsers tend not to agree on what constitutes a |
The linked PostCSS plugin uses:
I'm a little bit wary of point 1 (it might need more discussion in the abstract), but I'm very wary about point 2. On the other hand, that linked twitter thread includes a suggestion from Adam Argyle that doesn't rely on either of the above: html {
height: 100%;
}
body {
min-height: 100%;
} (He uses the |
Hello, this is my proposal:
|
Not sure what the status of
I think one important consideration between the two is that the former declaration allows authors to set e.g. |
Do we want to include something like:
or
???
to keep the page from being super short in the browser window.
The text was updated successfully, but these errors were encountered: