Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jim Andrews](https://uploads.teamtreehouse.com/production/profile-photos/10254812/micro_13419204_10154224607439414_6314176225575574009_n.jpg)
Jim Andrews
5,967 PointsCan 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.
1 Answer
![Jennifer Nordell](https://uploads.teamtreehouse.com/production/profile-photos/5432702/micro_jen-square.jpg)
Jennifer Nordell
Treehouse TeacherHi 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!