Re:Sticky Footer
by plondon514 on Monday September 30, 2019 @03:25AM
(#21112559)
Ironically this and (avoid 100vh on mobile web) https://chanind.github.io/javascript/2019/09/28/avoid-100vh-... are on the front page at the same time.
[ Parent
| on HN ]
And both of these "articles" are hardly worth their title let's be honest. This sticky footer one could just be a link to the flex-grow documentation on the MDN, and it's not even a real sticky footer. The 100vh one comments on an issue that we've known about since responsive design became a thing in 2011 (2012?). Also, putting "A Better Solution: javascript" at the end of a blog post about a CSS problem is a joke.
CSS is just broken. I want to use general expressions like
height = a.height + b.height - 2*c.heightYou can!
:root {
--header-height: 5em;
--container-height: 25em;
--other-height: 2.5em;
}
div {
height: calc(var(--container-height) - var(--header-height) + (var(--other-height)*2));
}But this example uses static sizes, unlike the sticky footer problem of the article (where e.g. the window can be resized by the user).
Can CSS calc() be used with dynamic widths or heights of other elements?
This seems more like coincidence than irony.
Re:Sticky Footer
by reissbaker on Monday September 30, 2019 @04:45AM
(#21112960)
The irony is that this "sticky footer" CSS uses a
min-height: 100vh
as part of achieving its effect.
Re:Sticky Footer
by Silhouette on Monday September 30, 2019 @05:37AM
(#21113253)
Although the article does end with a warning about cross-browser CSS being a bit more involved, and if you look at the full source code it links to, this is one of the issues it addresses.