Why CSS Calc() function only requires spaces before and after the "+" or "-" operator
P粉004287665
P粉004287665 2023-08-31 22:22:29
0
1
501
<p>For example: <code>calc(10px 2px);</code> is correct but <code>calc(10px 2px);</code> gives an error or <code>calc(10px - 2px);</code> is c or rect but <code>calc(10px -2px);</code> gives an error or. However, this does not apply to other operations</p>
P粉004287665
P粉004287665

reply all(1)
P粉691461301

For the operator, the operation may be slightly more complicated than calc(10px 2px);. I mean something like calc(5px -1px); is actually more complex and impossible to be calc(5px -1px);.

For the - operator, how does CSS know whether - is the minus operator or part of a negative number? I mean logically.

Additionally, whitespace makes code easier for humans to read.

Learn more about CSS calc() function in the documentation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!