less first try
htmlに導入
styles.less
cssの生成
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>
styles.less
//
@color: #4D926F;
.variable {
color: @color;
}
//
.rounded-corners (@radius: 5px) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px);
}
//
#nest {
h1 {
font-size: 26px;
font-weight: bold;
}
p {
font-size: 12px;
a {
text-decoration: none;
&:hover {
border-width: 1px
}
}
}
}
// &
@the-border: 1px;
@base-color: #111;
@red: #842210;
#calculate {
color: @base-color * 3;
border-left: @the-border;
border-right: @the-border * 2;
}
#function {
color: @base-color + #003300;
border-color: desaturate(@red, 10%);
}
cssの生成
.variable {
color: #4d926f;
}
#header {
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
#footer {
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
}
#nest h1 {
font-size: 26px;
font-weight: bold;
}
#nest p {
font-size: 12px;
}
#nest p a {
text-decoration: none;
}
#nest p a:hover {
border-width: 1px;
}
#calculate {
color: #333333;
border-left: 1px;
border-right: 2px;
}
#function {
color: #114411;
border-color: #7d2717;
}