How To Calculate CSS Height On The Fly Using Calc

Published Date Author: , Posted March 25th, 2020 at 10:45:03am

I needed to use an iframe between a pre-defined header and footer that would auto-fill the full height on any size screen.

On a desktop, the combined height of the header + footer was 223px and for mobile was 157px, so below find the CSS example:

calc(100vh - 223px) – for desktop
calc(100vh - 157px) – for mobile


No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.