我不能从Less开始。你能帮我开始学习吗?

时间:2016-10-31 17:22:07

标签: html variables less

我尝试从Less开始,但我不确定我做错了什么。这是一个非常简单的例子,但我看不到我在变量中使用的颜色。

你有什么想法吗?

enter image description here

HTML

<html>
 <head>
  <title>Ejemplo1</title>
  <link rel="stylesheet" type="text/css" href="style.less">
    <script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.7.1/less.min.js"></script>
 </head>

 <body>
  <div class = "num1"></div>
  <div class = "num2"></div>
  <div class = "num3"></div>
 </body>

</html>

LESS

@color1:red;

div{
 border: solid;
 margin:20px;
}

.num1{
 width: 200px;
 height: 400px;
 background: @color1;
}

.num2{
 width: 400px;
 height: 200px;
 background: @color1;
}

.num3{
 width: 300px;
 height: 300px;
 background: @color1;
}

2 个答案:

答案 0 :(得分:0)

是的!对不起,这可能是一个愚蠢的问题,但答案是:

<link rel="stylesheet/less" type="text/css" href="style.less" />

答案 1 :(得分:0)

您需要更改&#39; rel&#39; as&#39; stylesheet / less&#39;。因此,最终将样式表链接为,

#define __MAC_10_11_4 101104

您可以推荐更多here