L3F.WIN

Github及Hexo的使用

0%

学习stylus【15】其他 @-RULES

其他 @-RULES

stylus对大多数CSS @规则都有支持,比如@viewport,@page,@host,@supports和其他:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@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;
}
}

未知规则

stylus支持任何未知的@规则,因此它对为正式发布的规则很友好,因为CSS中的任何新规则都可以用Stylus的基于缩进的语法编写,并且可以完美呈现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@foo
@bar
width: 10px

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