<html> <head> <title>Less Functions</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <h1>Example using Functions</h1> <p class="mycolor">LESS enables customizable, manageable and reusable style sheet for web site.</p> </body> </html>
接下來,創(chuàng)建一個文件 style.less.
@color: #FF8000; @width:1.0; .mycolor{ color: @color; width: percentage(@width); }
lessc style.less style.css
.mycolor { color: #FF8000; width: 100%; }