How to Use the CSS calc() Function
Calc()is a function inside CSS files that takes a single mathematical expression as its parameter, with the expression's result used as the value.
The expression inside the
calc()function can contain any of the following operators:
Here are some examples of how to use it:
/** Additional **/
width: calc(100% + 10px);
/** Subtraction **/
width: calc(90% - 50px);
/** Multiplication **/
width: calc(25% * 2);
/** Division **/
width: calc(100% / 6);
If you need more information on the calc() method, check out the Mozilla Developer Documentation on the subject.
As always, thanks for reading and happy coding!