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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:09:08+00:00 2026-05-13T20:09:08+00:00

Lets say i have 50 element grid. If its wide list it is easy

  • 0

Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently.
Now lets say i want to do this and color code every 5th div. Is there a way to choose which css to apply based on a number? like instead of

<div class="odd">blah</div>
<div class="even">blah</div>
<div class="odd">blah</div>
<div class="even">blah</div>
<div class="fifthOdd">blah</div>
...
<div class="fifthEven">blah</div>

to do something like

<div class="1">blah</div>
<div class="2">blah</div>
...
<div class="5">blah</div>
...
<div class="10">blah</div>

and allow whoever writing the css to choose how the color scheme works based on their index?

  • 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-13T20:09:09+00:00Added an answer on May 13, 2026 at 8:09 pm

    Yes, with nth-child. Note that nth-child doesn’t work in IE, but it is a valid jQuery selector, so you can either use this with modern browsers and pure CSS, or with all browsers and a bit of presentational JavaScript.

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

Sidebar

Related Questions

Lets say I have a div element, with a background in position: 0%; how
Lets say I have a div #elements with a ul inside.The div has position:
Lets say I have a checkbox with id 'test' and its on a page
Lets say I have three divs in my HTML <div> <h2>This is div 1</h2>
For example. Lets say we have a stackpanel on a form. Its full of
Lets say i have the following web page: <html> <body> <div class="transform"> <span>1</span> </div>
Lets say I have a 3 column <table> or <div> with widths of 50%
Lets say we have this JPA-annotated class, with a property of type List. This
I'm having some Javascript woes, lets say we have a constructor function test(element) {
Lets say I have a container div, inside of which are div containers of

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.