height: calc(100vh-60px) Is this wrong?

In CSS, calc()functions are used to perform mathematical calculations and use the results as values ​​for CSS properties. The code you provided height: calc(100vh-60px)is incorrectly written.

The correct way to write it is to calc()add spaces on both sides of the mathematical expression in the function, as follows:

height: calc(100vh - 60px);

Writing this way ensures that the CSS parser correctly parses the mathematical expression and calculates the correct result. Note that spaces need to be added on both sides of operators in mathematical expressions to ensure correct evaluation.

Tool collection: https://aiburgeon.com/siteCollection/

insert image description here

Guess you like

Origin blog.csdn.net/qq_25741071/article/details/132671676