File: atrules.md

package info (click to toggle)
node-stylus 0.48.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,196 kB
  • ctags: 766
  • sloc: makefile: 38
file content (57 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
layout: default
permalink: docs/atrules.html
---

# Other @-rules

Stylus have a basic support for braceless syntax for most of the CSS @-rules, like `@viewport`, `@page`, `@host`, `@supports` and others:

    @viewport
      color: #00f

    @supports (display: flex)
      div
        display: flex

    @page :blank
      @top-center
        content: none

Would compile to

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

## Unknown at-rules

Stylus supports any yet unknown @-rules, so it is future-friendly, as any new at-rules in CSS could be written in indentation-based syntax of Stylus and would be rendered perfectly:

    @foo
      @bar
        width: 10px

        .baz
          height: 10px

Would be compiled to

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