我希望不显示/忽略除了一个多个<br/>
标记之外的所有标记,并保留<br/>
标记,其中只有一个标记存在于Web浏览器中显示的HTML页面。
我已经四处搜索了nth-child
,但只是删除了所有标签。使用简单的CSS,如何在第二段和第三段之间保留一个<br/>
标记,在下面的示例中保留第六和第七段以及第八段和第九段之间的单个<br/>
标记?
<!DOCTYPE html>
<html>
<head>
<style>
br:nth-child(1n+2) {
display:none;
}
</style>
</head>
<body>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<br/>
<br/>
<br/>
<br/>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
<p>The fifth paragraph.</p>
<p>The sixth paragraph.</p>
<br/>
<p>The seventh paragraph.</p>
<p>The eight paragraph.</p>
<br/>
<p>The ninth paragraph.</p>
</body>
</html>
答案 0 :(得分:1)
您可以使用br + br
,查看下面的更新代码段
br + br {
display: none;
}
&#13;
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<br/>
<br/>
<br/>
<br/>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
<p>The fifth paragraph.</p>
<p>The sixth paragraph.</p>
<br/>
<p>The seventh paragraph.</p>
<p>The eight paragraph.</p>
<br/>
<p>The ninth paragraph.</p>
&#13;