示例

@color:#4D926F;#header{color:@color;}h3{color:@color;}


说明

@color是定义变量#4D926F是变量的值color:@color表示调用变量


语法

@变量名:变量值;


编译生成的css代码(example.css)

#header{color:#4D926F;}h3{color:#4D926F;}


在html中使用(less1.html)

<!DOCTYPEhtml><html><head><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><title>less1</title><linkrel="stylesheet"href="example.css"></head><body><pid="header">header</p><h3>less1</h3></body></html>