0

I am having dynamic pages and contains div and paragraph like this for example:

<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>

What i am trying is show only that paragraph which has class="oe_view_nocontent" and hide the other one who has no class.

I tried to sort out by using these threads:

Hide long text except the first two paragraphs

CSS: hide table with no class or id

I tried:

p {
    display: none;
}
p.oe_view_noontent {
  display: div;
}

and from here: Can I write a CSS selector selecting elements NOT having a certain class?

My try:

p:not(.class) {
    display: none;
}

But i am not getting anything. I just want that

who has

class="oe_view_nocontent_create"

Any idea where i am doing mistake?

user3162878
  • 598
  • 3
  • 10
  • 25

2 Answers2

2

I think, you are looking for not:() selector.

p:not(.oe_view_nocontent_create) {
    display: none;
}
Gaurav Saraswat
  • 1,353
  • 8
  • 11
1

Posted comment as answer

p:not(.oe_view_nocontent_create) {
  display:none
}
<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>

codepen - codepen.io/nagasai/pen/rPqXjV

Naga Sai A
  • 10,771
  • 1
  • 21
  • 40