<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="sty.css">
</head>
<body>
<div>
<p>
<a href="#">less 嵌套</a>
</p>
</div>
</body>
</html>
给出上面的结构,我们在css中一般是这样写样式:
div{width:500px; height:500px; border:1px solid red;}
div p{width:300px; height:300px; border:1px solid green;}
div p a{color:orange;}
但是在less 中,我们可以嵌套样式,如下:
div{
width:500px;
height:500px;
border:1px solid red;
p{
width:300px;
height:300px;
border:1px solid green;
a{
color:orange;
}
}
}
上面就是less 的嵌套功能;