1

How to hide the second list - "account" using css only while no class and id.
I am not able to change the html!

<ul>
  <li class="active">
    <a aria-controls="menu" href="#menu">Menu</a>
  </li>
  <li>
    <a aria-controls="account" href="#account">Account</a>
  </li>
</ul>
1

2 Answers 2

3

this way

ul > li:nth-of-type(2) {
  display : none;
  }
<ul>
  <li class="active">
    <a aria-controls="menu" href="#menu">Menu</a>
  </li>
  <li>
    <a aria-controls="account" href="#account">Account</a>
  </li>
</ul>

Sign up to request clarification or add additional context in comments.

Comments

0

Put this in your css.

li:nth-child(2)
{
    visibility: hidden;
}

nth child of a tag means the nth occurance of a tag in any particular level. Here li:nth-child(2) means the 2nd li tag inside the ul tag.

Learn more about it here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.