nesting
CSS规则,这是组织样式表的有用方法。通常,每个元素都定位在不同的行上以对其进行样式设置,如下所示: nav {对于大型项目,CSS文件将包含许多行和规则。这是
背景颜色:红色;
}
nav ul {
list-style:none;
}
nav ul li {
display:inline-block;
}
nesting
可以通过在相应的父元素中放置子样式规则来帮助组织代码的地方: nav {
背景颜色:红色;
ul {
list-style:none;
li {
display:inline-block;
}
}
}
nesting
技术为.blog-post
元素的两个子元素重新组织CSS规则。出于测试目的, h1
应该位于p
元素之前。 h1
和p
嵌套在.blog-post
父元素中。
testString: 'assert(code.match(/\.blog-post\s*?{\s*?h1\s*?{\s*?text-align:\s*?center;\s*?color:\s*?blue;\s*?}\s*?p\s*?{\s*?font-size:\s*?20px;\s*?}\s*?}/gi), "Your code should re-organize the CSS rules so the h1
and p
are nested in the .blog-post
parent element.");'
```
This is a paragraph