The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Understanding and using CALC() Reply To: [Solved] Understanding and using CALC()



Thanks for the info, but I sill don’t follow, am obviously not the math/logic person I thought I was :)

I am going the longer route (which I previously added) which I can understand and follow. There is probably a better cleaner way to do what I want, but I will stick to what I understand, as I have to teach those who use my work as well.

Ive dropped the “%” margin for 30px and have tested with the results I expected.


.onequarter{width:calc((100% - (3 * 30px)) / 4);}
.twoquarter{width:calc((100% - (3 * 30px)) / 4 * 2 + 30px);}
.threequarter{width:calc((100% - (3 * 30px)) / 4 * 3 + 2 * 30px);}

Obviously Calc is still an “in work” element for some browsers, but knowing how to use it does open things for the future.

Cheers & Thanks for your help