<html> <head> <title>Less Namespaces and Accessors</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <h1>Example using Namespaces and Accessors</h1> <p class="myclass">LESS enables customizable, manageable and reusable style sheet for web site.</p> </body> </html>
接下來, 創(chuàng)建一個文件 style.less.
.class1 { .class2 { .val(@param) { font-size: @param; color:green; } } } .myclass { .class1 > .class2 > .val(20px); }
lessc style.less style.css
.myclass { font-size: 20px; color: green; }