2023年6月21日发(作者:)
css编写规范:如何合并组合类和嵌套类css重构1:合并具有相同的属性的选择器原内容:h2 {
color: red;
}
.thisOtherClass {
color: red;
}
.yetAnotherClass {
color: red;
}重构后:h2, .thisOtherClass, .yetAnotherClass {
color: red;
}css重构2:嵌套⽹页结构如下:
Chocolate curry
This is my recipe for making curry purely with chocolate
Mmm mm mmmmm
嵌套css如下:#top {
background-color: #ccc;
padding: 1em
}
#top h1 {
color: #ff0;
}
#top p {
color: red;
font-weight: bold;
}
2023年6月21日发(作者:)
css编写规范:如何合并组合类和嵌套类css重构1:合并具有相同的属性的选择器原内容:h2 {
color: red;
}
.thisOtherClass {
color: red;
}
.yetAnotherClass {
color: red;
}重构后:h2, .thisOtherClass, .yetAnotherClass {
color: red;
}css重构2:嵌套⽹页结构如下:
Chocolate curry
This is my recipe for making curry purely with chocolate
Mmm mm mmmmm
嵌套css如下:#top {
background-color: #ccc;
padding: 1em
}
#top h1 {
color: #ff0;
}
#top p {
color: red;
font-weight: bold;
}
发布评论