CSS3 using Calc () to calculate the height of vh px

Source: Internet
Author: User

Viewport
Viewport: The visual window, which is the browser.
VW viewport width, 1vw equals viewport width of 1%
VH viewport height, 1VH equals viewport high of 1%



CSS3 using Calc


Calc () uses common mathematical rules, but it also provides more intelligent functionality:


> Use "+", "-", "*" and "/" arithmetic;
> can use percentages, px, EM, REM and other units;
> can be mixed with various units for calculation;
> Expressions with "+" and "-" must have a space before and after it, such as "Widht:calc (12%+5em)" This is not a blank notation is wrong;
The > Expression has "*" and "/", it can have no spaces before and after it, but it is recommended to leave a space.

For example: Set the height of the div element to the current window height -100px
div{
Height:calc (100vh-100px);
}

CSS3 using Calc () to calculate the height of vh px

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.