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

  • Home
  • SEARCH
  • 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 7947015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:18:43+00:00 2026-06-04T01:18:43+00:00

is there a way to select with css, elements which have the index multiple

  • 0

is there a way to select with css, elements which have the index multiple of 6 inside a parent element?

for example, in this case i want to choose only multiple of 3:

<div>
    <p></p>
    <p></p>
    <p></p> <!--to select -->
    <p></p>
    <p></p>
    <p></p> <!--to select -->
    <p></p>
    <p></p>
    <p></p> <!--to select -->
</div>
  • 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-04T01:18:45+00:00Added an answer on June 4, 2026 at 1:18 am

    Use :nth-child(n):

    p:nth-child(3n) {
      background: red
    }
    

    Demo: http://jsbin.com/azehum/4/edit

    This method works in IE9+ (source: caniuse.com). If you need support in older browsers, you could use jQuery to select the elements and add a class to them:

    $("p:nth-child(3n)").addClass("redbg");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to only affect visible elements with this css? table.grid tr.alt:nth-child(odd)
Is there any way to select/manipulate CSS pseudo-elements such as ::before and ::after (and
Is there a way in CSS to select all input elements of type text?
Is there a way to select all CSS rules of an element with JavaScript?
Is there a way to select an element with CSS based on the value
Is there a way to select a parent element based on the class of
Is there a better way to select grandparent elements in jQuery in order to
Is there a way I can select a portion of multiple lines in vim
Is there any way only using CSS (no script) to check if an element
I there ANY way in javascript that we could trigger a select element (dropdown

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.