The CSS Calc Function

Sarah Chima on December 19, 2017

I was quite excited when I first read an article on the CSS calc function. For real, the ability to perform calculations in CSS with different u... [Read Full]
markdown guide

I avoided calc for a long time until recently where it just made too much sense to use it, and I was kind of floored by how well supported it was. I've always avoided it because it seemed like one of those things that would need to be prefixed and wouldn't be supported in lots of browsers, but I was totally wrong.


I've been a huge fan of the CSS's calc() from time ago.

What I really miss is having units like vh but refering to the element's container instead of the whole viewport.


Sometimes I don't follow rules when working with calc() , I mix some Xvw with Ypx and it solves the problem I face in multiples devices view-port, I think Ihave to push myself sometimes to work with that rule , I mean flexbox, css grid and this powerful calc() , who needs bootstrap or any other css framework anymore? pure is better !
keep writing these great articles Sarah β™₯


I'm getting used to not using a framework. CSS keeps getting better. Thank you for always reading my articles.😊😊


I recently used calc for the first time to dynamically calculate row heights in css grid.

It was actually my first time incorporating css grid, css variables, and the calc function, and it just came to me naturally as a solution. I stepped back and was like omg!


Woah. Thanks for posting this! Bookmarked, and going in my toolbox so fast! Definitely to be used with care, but when you really do need it, nothing else will do the same thing nearly so well.

code of conduct - report abuse