嵌套(Nesting)即一个选择器中嵌套另一个选择器来实现继承,写起来方便,看起来也清爽,将偷懒进行到底~
使用less
#header {
h1 {
color: #46acb6;
font-size: 36px;
}
p { font-size: 12px;
a { text-decoration: none;
&:hover { border-bottom: 1px solid Tomato; }
}
}
}
输出css
#header h1 {
color: #46acb6;
font-size: 36px;
}
#header p {
font-size: 12px;
}
#header p a {
text-decoration: none;
}
#header p a:hover {
border-bottom: 1px solid Tomato;
}