首页 > 其他 > 详细

Less的学习(一)

时间:2016-03-08 10:44:34      阅读:179      评论:0      收藏:0      [点我收藏+]

1、html部分

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet/less" type="text/css" href="less/test.less" />
    <script src="http://cdn.bootcss.com/less.js/1.7.0/less.min.js"></script>
    <script></script>
</head>
<body>
    <div id="header" style="border:1px solid red;">XXXXXXXXXXXXXXXXX<p>aaaaa</p></div>
    <h2 style="border:1px solid blue;">111111</h2>
</body>
</html>

 

2、less/test.less文件内容

@color:#4D926F;

.rounded-corners (@radius: 5px) {
   -webkit-border-radius: @radius;
   -moz-border-radius: @radius;
   -ms-border-radius: @radius;
   -o-border-radius: @radius;
   border-radius: @radius;
}


#header {
   color:@color;
   .rounded-corners(10px);
}
h2 {
   color:@color;
   .rounded-corners;
}


#header {
   h1 {
      font-size: 26px;
      font-weight: bold;
   }
   p {
      font-size: 12px;
      a {
         text-decoration: none;
         &:hover {
            border-width: 1px
         }
      }
   }
}

 

3、显示效果图

技术分享

 

备注:要挂在在服务器上才能看到效果。

 

Less的学习(一)

原文:http://www.cnblogs.com/wanliyuan/p/5252985.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!