父子关系的
html
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="demo63.css"></head><body><div class="box"><p>12345678</p></div></body></html>
less
.box {
width: 200px;
height: 200px;
background-color: blue;
p {
color: red;
}
}
less编译成的css
.box {
width: 200px;
height: 200px;
background-color: blue;
}
.box p {
color: red;
}
效果图
交集、伪类、伪元素选择器
如果遇见(交集|伪类|伪元素选择器)
<a name="XcpcE"></a>
## less
```less
.box {
width: 200px;
height: 200px;
background-color: blue;
a {
color: red;
&::after {
content: " very good!";
}
}
}
less编译成的css
.box {
width: 200px;
height: 200px;
background-color: blue;
}
.box a {
color: red;
}
.box a::after {
content: " very good!";
}
c
