1.选择器
基本用法
相比css省略了大括号 冒号 封号 如果习惯添加 stylus也不会报错1
2
3
4
5
6
7
8//stylus
body
color white
//css
body{
color:white;
}
&符号的基本使用
&符号表示父元素1
2
3
4
5
6
7
8
9
10
11
12
13// stylus
body
color red
&:hover
color #fff
// css
body{
color:red;
}
body:hover{
color: #fff;
}
2.变量
使用变量的时候 建议$开头命名1
2
3
4$font-size = 14px
body
font-size $font-size
3.插值(设置浏览器兼容性)
1 | // 兼容性设定 |
4.运算符
下列运算符
优先级依次从最高到最低1
2
3
4
5
6
7
8
9
10
11
12
13
14
15[]
! ~ + -
is defined
** * / %
+ -
... ..
<= >= < >
in
== is != is not isnt
is a
&& and || or
?:
= := ?= += -= *= /= %=
not
if unless
####一元运算符1
2
3
4!0 //true
非0及真
-5px // -5px
--5px // 5px
not运算符最低
####二元运算符