Calc() is a great css property!

Phreaddee

Super Moderator
Staff member
Code:
width: calc(100% * 1 / 2 - 20px);

an interesting concept. box-sizing I've found has solved a lot of these maths problems for me, but it'll be worth giving it a shot.
 

ronaldroe

Super Moderator
Staff member
I've been using calc quite a bit the last several projects. Browser support is pretty deep too.

I use border-box for everything, but it doesn't include margins, so calc helps clean that up as well.
 

lionel.web

Member
Is it necessary to use box-sizing:border-box for everything in a page?

I have found it and its use a while ago, and i use it sometimes only and when it helps me for measuring elements.
What is the big difference to size an element with it's padding and border or not, for example.
Why is box-sizing border box, so good?
 
The only downside Ive come across is, I did a site that had a slide out side nav with a full screen slide show. On that I had to over ride it because it caused some oddness. Just a heads up.
 
Last edited:
Top