Jim Andrews2,380 Points
Can we reference the footer as a variable in the calc() function rather than declare it's actual height?
In other words, if we later change the size of the footer, it will break this equation. Is there a way of calling out the footer height as a variable? Like...
calc(100vh - footerHeight)
where footerHeight is equal to whatever the height of that element is? So if we go in and change the height in the CSS we don't need to change this equation.
Jennifer NordellTreehouse Moderator
Hi there, Jim Andrews ! Sure, there's a way. The best solution would probably be to make a CSS variable and set the height of the footer to that variable and use it yet again in the
calc(). I'm not sure if this workshop has made it to be part of one of the "tracks" yet or not as I believe it is relatively new, but you can find a 37 minute workshop with Guil here.
CSS variables are great and can save you tons of time and hunting and searching for values that would need to be changed multiple places. I cannot recommend it highly enough.
Hope this helps!