🗒️@layer

cascade layer,级联层

@layer 用来声明 cascade layer(级联层),也可以定义多个 cascade layers 的优先顺序。

格式:

@layer layer-name {rules}
@layer layer-name, layer-name, layer-name;   /* 优先级:低→高 */

举例:

@layer module, state;

@layer state {
  .alert {
    background-color: brown;
  }
  p {
    border: medium solid limegreen;
  }
}

@layer module {
  .alert {
    border: medium solid violet;
    background-color: yellow;
    color: white;
  }
}

Last updated