2017-02-09 23 views
1

我想將CSS的某個部分提供給支持「display:grid」但不是IE/MS Edge的瀏覽器。如何混合正面和負面的@support查詢?CSS @supports:混合「不」與「和」或「或」

你可以寫'而不是'還是有類似的符號?不幸的是,以下內容不起作用。

@supports not (-ms-ime-align:auto) and (display: grid) { 
    display: none; 
} 
+0

可能的指導意見:http://stackoverflow.com/q/33359157/3597276 –

回答

4

你需要另一套圍繞not表達括號:

@supports (not (-ms-ime-align: auto)) and (display: grid) { 
 
    .example { display: none; } 
 
}
<p class=example>You are using IE or Microsoft Edge, 
 
or a different browser that does not support <code>display: grid</code>.

這是要清楚的是,not旨在否定(-ms-ime-align: auto)表達,而不是整個@supports表達式,這是媒體查詢中混淆的無盡源泉(其中not總是否定了整個媒體查詢,而不是僅當使用and與更多條件結合時的一個條件)。

+0

不相干的問題,你是如何得到403,000代表的?那肯定不能只是回答問題? – jdmdevdotnet

+1

@AlGoreRhythm:[我一直在附近。](http://stackoverflow.com/help/badges/13/yearling?userid=106224) – BoltClock

+0

@AlGoreRhythm他得到了[相當有點代表提問](http ://stackoverflow.com/users/106224/boltclock?tab = questions)。但等到你在這個網站上看到Jon Skeet ... – TylerH