跳至主要內容

custom-media-pattern

指定自訂媒體查詢名稱的樣式。

@custom-media --foo (max-width: 30em);
/** ↑
* The pattern of this */

message 次要選項 可接受此規則的引數。

選項

regex|string

字串會轉換成類似 new RegExp(yourString) 的 RegExp — 因此務必正確跳脫。

給定字串

"foo-.+"

以下樣式會被視為問題

@custom-media --bar (min-width: 30em);

以下樣式不會被視為問題

@custom-media --foo-bar (min-width: 30em);