2016-05-30 19 views
2

這是我的腳本少:CSS計算值表達被標記爲無效與柔性盒

@info-box: 185px; 


.info { 
    width: ~"calc(100%[email protected]{info-box})"; 

} 

少編譯它作爲預期`寬度:計算值(100%-185px);

但是,chrome將該表達標記爲無效。

enter image description here

我想知道是否有任何與flex-box顯示模式

我已經使用了計算公式max-width,我得到了相同的結果。

如果我將widthmax-width設置爲數字值,問題就會消失。

+0

你確定你在兩邊減去了'-'嗎? – zer00ne

+0

哦,我認爲這是答案!請將它作爲答案發布,我會接受它。 –

+0

這很好,它是無痛和簡單的,我提供了一個答案,先生。 :) – zer00ne

回答

0

確保使用calc

calc(100% - 12px) 
     ^-^------------The `calc` property is very particular 
      about the spacing of the operator. (e.g. - +/*) 

當它用來推動我堅果當它的工作,但有時沒有其他時間在運營商的兩側有空間。然後我讀了這個article