[筆記][scss]calc(x-y) 失效

Athem
1 min readDec 16, 2019

--

這個故事告訴我們要看文件

The + and - operators must be surrounded by whitespace.

哈哈…低級的錯誤…事情是這樣的,我想手刻RWD頁面:

// scss
.sample-box {
width: calc(100vw-20px); // 即便20px變成100px高度也不變
}

中間甚至用暴力的方式用了position,後來想到去看文件才知道要寫這樣:

width: calc(100vw - 20px);

yes…operators must be surrounded by whitespace.

心得:

有問題就要看文件orz

--

--