Home > Software engineering >  hide second div of a particular p tag using css
hide second div of a particular p tag using css

Time:10-19

i wish to hide the second div after this div,there is no identifier for that div. thats why i took this p tag attribute as identifier.. i tried using jquery ,but in page onl oad its visible for sometimes, is there any way to hide it permanemently

 div p[data-udy-fe="text_-a91032"] {
     
    }

am adding my jquery code here,but when page loading we can see div content for some seconds i need to hide it permanently

 $("p").each(function(){
    
    if($(this).attr('data-udy-fe') == 'text_-a91032') {
        $(this).next('div').next('div').hide();
    }
});

CodePudding user response:

You can use div div selector

p[data-udy-fe="text_-a91032"]  div   div {
  display: none;
}
<div>
  <div>Paragraph1</div>
  <div>Paragraph2</div>
  <p data-udy-fe="text_-a91032">Paragraph3</p>
  <div>Paragraph4</div>
  <div>this one is not displayed</div>
  <div>Paragraph6</div>
<div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

You can use the general sibling combinator to select the p tag which occurs after your specific element.

div p[data-udy-fe="text_-a91032"] ~ p {
     display: none;
}
  • Related