CSS calc() function is not working
When I was writing styles of affix, whose width needs to be set by the calc
function of CSS
.fix {
position: fixed;
top: 20px;
width: calc(100%-20px);
}
However, the width is not working and the calc
function fail to calculate the resulting px. After searching for this problem, I finally found out that the calc
function should be written like the following
.fix {
position: fixed;
top: 20px;
width: calc(100% - 20px);
}
That is, two whitespaces need to be reserved before and after the arithmatic operator.
There is no comment, let's add the first one.