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 4009140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:50:29+00:00 2026-05-20T08:50:29+00:00

With CSS3 I know I can use the nth-child(an + b) selector. I have

  • 0

With CSS3 I know I can use the nth-child(an + b) selector. I have a table with 5 rows and I would like to select the 1st, 2nd, 4th and 5th rows with one statement. Is this possible or do I have to use a minimum of two statements like this:

:nth-child(-n+2)  /* gets 1 and 2 */
:nth-child(n+4)   /* gets 4 and 5 */

I was hoping for a syntax like nth-child(1,2,4,5) or nth-child(1-2,4-5) but it doesn’t appear to be part of the spec.

(I have no control over the page and there are no IDs/classes on these rows.)

  • 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-05-20T08:50:30+00:00Added an answer on May 20, 2026 at 8:50 am

    If you want to be explicit, one way is to repeat :nth-child() like so:

    tr:nth-child(1), tr:nth-child(2), tr:nth-child(4), tr:nth-child(5)
    

    Alternately, since the table happens to have exactly 5 rows, you can just exclude the third row and you’ll get rows #1, #2, #4 and #5:

    tr:not(:nth-child(3))
    

    jsFiddle preview

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would like to know how to hide an div after a set of css3
I know how to use CSS3 shadows. However I am trying to achieve a
I would like to know a way to generate a single pixel in JavaScript
As documented we can define animation in CSS3 like .class1{ animation: name duration timing-function
How can I select the nth-element of a X class using only CSS 3
Does anyone know of a simple HTML5/CSS3 framework which applies a minimum of formatting
In CSS3 font-face , there are multiple font types included like ttf , eot
I have this CSS3 animation that works in Chrome .circle-label-rotate { -webkit-animation-name: rotateThis; -webkit-animation-duration:.5s;
Does anyone know of a jquery css3 plugin that supports cross browser gradients. All
Does anyone know if there is a php library, or if there isnt, have

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.