css编写规范:如何合并组合类和嵌套类
css重构1:合并具有相同的属性的选择器 重构后: |
css重构2:嵌套 网页结构如下: <div id="top"> <h1>Chocolate curry</h1> <p>This is my recipe for making curry purely with chocolate</p> <p>Mmm mm mmmmm</p> </div> 嵌套css如下: #top { background-color: #ccc; padding: 1em } #top h1 { color: #ff0; } #top p { color: red; font-weight: bold; } |