我想删除带有“复杂”子级的行。我不知道该怎么做。 我使用引导程序,不确定是否会有所不同,我想没有;)
这是我的工作:
https://jsfiddle.net/1w9tv4ce/2/
我希望所有test-01
都为绿色,然后为test-02
黑色,test-03
绿色,test-04
黑色。
.rows-search div:nth-child(even) {
background-color: #95CA44;
}
.rows-search div:nth-child(odd) {
background-color: black;
}
.search-light-grey {
color: darkgray;
}
<div class="container search-light-grey">
<div class="rows-search">
<div id="1">
test-01
<div>
1
</div>
<div>
<div>
2a
</div>
<div>
2b
</div>
<div>
2c
</div>
</div>
</div>
<div id="2">test-02</div>
<div id="3">test-03</div>
<div id="4">test-04</div>
</div>
</div>
非常感谢!
答案 0 :(得分:2)
在选择器中使用子组合器(>
)(这将仅针对立即子元素)-请参见以下演示:
private
.rows-search > div:nth-child(even) { /* <-- changed */
background-color: #95CA44;
}
.rows-search > div:nth-child(odd) { /* <-- changed */
background-color: black;
}
.search-light-grey {
color: darkgray;
}
答案 1 :(得分:2)
根据我的评论,使用final ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new DefaultScalaModule());
final Child alice = new Child("Alice");
final List<Child> children = new ArrayList<>();
children.add(alice);
final String bobString = mapper.writeValueAsString(
new Parent("Bob",
JavaConversions.asScalaBuffer(children).toList()));
System.out.println(bobString);
final Parent bob = mapper.readValue(bobString, Parent.class);
System.out.println(bob);
选择器-表示直子
https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator
>
.rows-search > div:nth-child(even) {
background-color: #95CA44;
}
.rows-search > div:nth-child(odd) {
background-color: black;
}
.search-light-grey {
color: darkgray;
}