Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:06:02+00:00 2026-06-09T06:06:02+00:00

Is it possible to select multiple children past a defined number with CSS selectors?

  • 0

Is it possible to select multiple children past a defined number with CSS selectors?

I’d like to hide all list items past #3:

<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li> <!-- hide this -->
  <li>5</li> <!-- hide this -->
</ul>

<style>
  ul li:nth-child(X) {
    display: none;
  }
</style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:06:03+00:00Added an answer on June 9, 2026 at 6:06 am

    I do not know which browser supports this, but you can pass a formula to :nth-of-type():

    ul li:nth-of-type(1n+4) {display: none;} /* should match your case */
    

    Further details on: http://www.w3schools.com/cssref/sel_nth-of-type.asp

    Edit

    I altered it from (n+4) to (1n+4) since the first version works but isn’t valid. I use this in media queries to hide cut-down items on smaller screens.


    Example:

    b:nth-of-type(1n+4){ opacity:.3; }
    <b>1</b>
    <b>2</b>
    <b>3</b>
    <b>4</b>
    <b>5</b>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if it's possible to use a wildcard to select multiple cookies. I'm
is it possible to be able Multiple select files when make browse file? any
Is it possible to dynamically create a select statement with multiple where() clauses? Suppose
I'm using CakePHP 2.0. Is it possible to display multiple fields in select/dropdown box
Possible Duplicate: Select xml node by attribute in php Is there any function like
Is it possible to select multiple tables and make inner join on one of
Is it possible to select multiple contacts at one time as the Address Book
Is it possible to select multiple parts of text within a WPF textbox? For
Is it possible to select multiple entiies in ForEach Extension Method? (i.e) partial code
Using PHP, is it possible to select multiple rows from one table, in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.