1.嵌套
.container{
font-size:18px;
.content{
width: 40px;
}
.footer{
background: red;
}
.nav{
height: 60px;
}
}
.container {
font-size: 18px;
}
.container .content {
width: 40px;
}
.container .footer {
background: red;
}
.container .nav {
height: 60px;
}
2.父选择器&
.container{
a{
list-style: none;
&:hover{
background: red;
}
}
.top{
border: 3px solid red;
&-left{
float: left;
width: 200px;
}
}
}
.container a {
list-style: none;
}
.container a:hover {
background: red;
}
.container .top {
border: 3px solid red;
}
.container .top-left {
float: left;
width: 200px;
}
3.属性嵌套
p{
font: {
size: 20px;
weight: bold;
style: normal;
family: 'Courier New', Courier, monospace;
}
}
p {
font-size: 20px;
font-weight: bold;
font-style: normal;
font-family: "Courier New", Courier, monospace;
}