跳至內容
在此頁面

其他 @ 規則

Stylus 對大部分的 CSS @ 規則提供基本的無大括號語法支援,例如 @viewport@page@host@supports

@viewport
  color: #00f

@supports (display: flex)
  div
    display: flex

@page :blank
  @top-center
    content: none
@viewport
  color: #00f

@supports (display: flex)
  div
    display: flex

@page :blank
  @top-center
    content: none

編譯為

@viewport {
  color: #00f;
}
@supports (display: flex) {
  div {
    display: flex;
  }
}
@page :blank {
  @top-center {
    content: none;
  }
}
@viewport {
  color: #00f;
}
@supports (display: flex) {
  div {
    display: flex;
  }
}
@page :blank {
  @top-center {
    content: none;
  }
}

未知的 at 規則

Stylus 支援任何尚未定義的 @ 規則,因此它具有前瞻性,因為任何新的 CSS at 規則都可以用 Stylus 的縮排語法撰寫,並且可以完美地呈現

@foo
  @bar
    width: 10px

    .baz
      height: 10px
@foo
  @bar
    width: 10px

    .baz
      height: 10px

編譯為

@foo {
  @bar {
    width: 10px;
    .baz {
      height: 10px;
    }
  }
}
@foo {
  @bar {
    width: 10px;
    .baz {
      height: 10px;
    }
  }
}