Calc () and CSS3calc () in CSS3 ()
What is calc ()?
Calc is the abbreviation of the English word calculate (calculation). It is a new feature of css3;
MDN can be used in any length, value, time, angle, frequency, etc;
/* Property: calc (expression) */width: calc (100%-80px );
You can use the +-*/symbol to perform operations;
Note that +-must be separated by spaces;
Width: calc (100%-8px);/* an error occurs, and the result is 0 */
Width: calc (100%-8px);/* When the +-symbol is separated by a space, the operation is successful */
When using the */operator, you must ensure that there is a value of the numerical type;
If an operation error occurs, the result is 0;
Browser support:
IE9 +, FF4.0 +, Chrome19 +, Safari6 +;
Some small examples:
It can also be used in combination
You can also use parentheses to increase the computing priority.
Calc () is still relatively useful. For example, if you want to center an absolute positioning element, it is usually left: 50%; top: 50%; but is it true that it is centered? This method does not include the width and height of the element. Using calc () can center the element previously implemented by js.
Below are some references:
Https://developer.mozilla.org/en/docs/Web/CSS/calc
Http://www.w3cplus.com/css3/how-to-use-css3-calc-function.html