目录

Comma

描述 (Description)

它将属性值添加到最后。

例子 (Example)

以下示例演示了在LESS文件中使用合并逗号功能 -

<!doctype html>
   <head>
      <title>Merge Comma</title>
      <link rel = "stylesheet" href = "style.css" type = "text/css" />
   </head>
   <body>
      <h2>Example of Merge Comma</h2>
      <p class = "class">Hello World!!!Welcome to IoWiki...</p>
   </body>
</html>

接下来,创建style.less文件。

style.less

.myfunc() {
   box-shadow+: 5px 5px 5px grey;
}
.class {
   .myfunc();
   box-shadow+: 0 0 5px #f78181;
}

您可以使用以下命令将style.less编译为style.css -

lessc style.less style.css

执行上面的命令; 它将使用以下代码自动创建style.css文件 -

style.css

.class {
   box-shadow: 5px 5px 5px grey, 0 0 5px #f78181;
}

输出 (Output)

请按照以下步骤查看上述代码的工作原理 -

  • 将上述html代码保存在merge_comma.html文件中。

  • 在浏览器中打开此HTML文件,将显示以下输出。

合并
↑回到顶部↑
WIKI教程 @2018