Jump to content

Apply CSS to specific list item


newcoder1010

Recommended Posts

Hello,

 

HTML:

<ul class="responsive-menus-simple" id="rm-no-id-main">
  
  <li><a href="#" data-toggle="modal" data-target="#login-modal">Login</a></li>
  <li><a href="#" data-toggle="modal" data-target="#register-modal">Register</a></li>
</ul>

I would like to remove the register link. I cant do it from html. How to apply 

display:none;

to the 2nd item (register)? 

 

Thank you.

Link to comment
Share on other sites

Can you not remove it from the HTML? That would be the ideal solution.

In CSS, you can give a class name to the object or you can use the :nth-child selector.

.responsive-menus-simple li:nth-child(2) {
  display: none;
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...