0

Using one css code i want to hide 'li' element with 'C' text from both the code.

I tried

.header.links .nav.item:nth-child(3)
{display:none!important;}

But its not working

.header.links .nav.item:nth-child(3) {
  display: none!important;
}
<ul class="header links">
  <li class="greet welcome" data-bind="scope: 'customer'"> </li>
  <li class="nav item">A</li>
  <li class="nav item">B</li>
  <li class="nav item">C</li>
  <li class="nav item">D</li>
  <li class="nav item">E</li>
</ul>

Expected answer should be A B D E

Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70
Nafsss
  • 103
  • 2
  • 9
  • 1
    Actually the "c" is in 4th poistion.. so change the child(3) to child(4) – Manikandan2811 Sep 13 '19 at 11:47
  • `.nav.item + .nav.item + .nav.item { display:none; } .nav.item + .nav.item + .nav.item + .nav.item { display: list-item; }` would work in theory, but whether that’s “nice” is probably a different matter … – misorude Sep 13 '19 at 11:50

0 Answers0