gpt4 book ai didi

css - 如何在div中隐藏p1

转载 作者:太空宇宙 更新时间:2023-11-04 04:54:54 24 4
gpt4 key购买 nike

如何从一个 div 中只删除一个段落 (p1)?这是我完整的 html 和 css:http://jsfiddle.net/8Q3YH/

我想从下面完全删除 p1。

<div id="quickSummary">
<p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p>
<p class="p2"><span>Download the sample <a href="zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p>
</div>

最佳答案

用 CSS 你会做

#quickSummary .p1 { display:none; }

这会隐藏类为 p1 的元素

你可以使用伪类,但不是所有浏览器都支持

应该是

#quickSummary p:first-child { display:none; }

也就是说,quickSummary 中的第一个段落标签将被隐藏。

希望这对您有所帮助。

关于css - 如何在div中隐藏p1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12670620/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com