我有动态页面并包含 div 和段落,例如:
<div class="oe_view_nocontent">
<p class="oe_view_nocontent_create">
Click to add a contact in your contacts directory.
</p>
<p>
Odoo helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.
</p>
</div>
我正在尝试的是仅显示具有 class="oe_view_nocontent" 的段落并隐藏另一个没有类的段落。
我试图通过使用这些线程来解决问题:
Hide long text except the first two paragraphs
CSS: hide table with no class or id
我试过:
p {
display: none;
}
p.oe_view_noontent {
display: div;
}
从这里开始: Can I write a CSS selector selecting elements NOT having a certain class?
我的尝试:
p:not(.class) {
display: none;
}
但是我没有得到任何东西。我只想要那个
谁有
class="oe_view_nocontent_create"
知道我哪里做错了吗?
最佳答案
我认为,您正在寻找 not:() 选择器
。
p:not(.oe_view_nocontent_create) {
display: none;
}
关于css - 如何使用CSS隐藏没有类的段落?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54714433/