Calc in CSS3 ()

Source: Internet
Author: User

What is calc ()?

Calc is an abbreviation of the English word Calculate (calculation), is a new function of CSS3;

The interpretation of MDN can be used in any length, value, time, angle, frequency, etc.;

/**/Width:calc (100%-80px);

You can use the +-*/symbol to perform the operation;

But it is important to note that the +-must be separated by a space;

/**/
/* when +-   */

When using the */operator, a value must be guaranteed to be a numeric type;

If the operation is wrong, the result is 0;

Browser support level:

ie9+,ff4.0+,chrome19+,safari6+;

Some small examples:

can also be combined with

You can also use parentheses to raise the priority of operations

Calc () is still relatively used, for example, to center an absolutely positioned element, generally left:50%;top:50%; but is it really centered? This approach does not take into account the width and height of the element. Using calc () can be used to achieve the center of 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

Calc in CSS3 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.