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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:22:05+00:00 2026-06-16T00:22:05+00:00

I have a table styled with CSS with even and odd . The td

  • 0

I have a table styled with CSS with even and odd. The td even/odd CSS codes:

#table_box tr:nth-child(odd) td { background-color:#ffffff } /*odd*/
#table_box tr:nth-child(even) td { background-color:#f5f9fa } /* even*/
#table_box tr:hover td { background-color:#fffbae; } /* hovering */

enter image description here

I want to have multi even/odd color rows styles like the below image:
enter image description here

Can I do this with CSS? I was trying to do it but colors don’t show and just even/odd styled.

  • 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-16T00:22:06+00:00Added an answer on June 16, 2026 at 12:22 am

    Use this fragments:
    HTML changes:

            <tr>
                    <td class="blueh2">1</td>
                    <td class="blueh2">&#1777;&#1779;&#1785;&#1777;/&#1776;&#1780;/&#1779; &#1776;&#1785;:&#1780;&#1785;:&#1780;&#1783;</td>
                    <td class="blueh2">&#1777;&#1779;&#1785;&#1777;/&#1776;&#1780;/&#1779; &#1777;&#1778;:&#1777;&#1785;:&#1780;&#1776;</td>
                    <td class="greenh2">2.5</td>
                    <td class="greenh2">2.5</td>
                    <td class="purpleh2">6.75MB</td>
                    <td class="purpleh2">54.13MB</td>
                    <td class="purpleh2">60.87MB</td>
                    <td class="purpleh2">60.87MB</td>
                </tr>
    

    CSS changes:

    #table_box tr:nth-child(odd) td { background-color:#ffffff } /*odd*/
    #table_box tr:nth-child(even) td.greenh2 { background-color:#f00} /* even*/
    #table_box tr:nth-child(even) td.blueh2 { background-color:#0f0} /* even*/
    #table_box tr:nth-child(even) td.purpleh2 { background-color:#00f} /* even*/
    #table_box tr:hover td { background-color:#fffbae; } /* hovering */
    
    th.grey{
    color:#7c7c7c!important;
    }
    th.blueh{
    background-color:#174797;
    color:#FFF!important;
    }
    th.blueh2{
    background-color:#5492cf;
    color:#FFF!important;
    padding:3px!important;
    }
    th.greenh{
    background-color:#579f0f;
    color:#FFF!important;
    }
    th.greenh2{
    background-color:#a4dd4f;
    color:#FFF!important;
    padding:3px!important;
    }
    th.purpleh{
    background-color:#8e04ca;
    color:#FFF!important;
    }
    th.purpleh2{
    background-color:#d984fd;
    color:#FFF!important;
    padding:3px!important;
    }
    

    You’ll need to tweak it some more to fit your desired output, but I guess the general idea is clear.
    You could also do it with plain CSS without changing your HTML code if you want:

    #table_box tr:nth-child(odd) td { background-color:#ffffff } /*odd*/
    #table_box tr:nth-child(even) td:nth-child(1) { background-color:#f00} /* even*/
    #table_box tr:nth-child(even) td:nth-child(2) { background-color:#0f0} /* even*/
    #table_box tr:nth-child(even) td:nth-child(3) { background-color:#00f} /* even*/
    #table_box tr:hover td { background-color:#fffbae; } /* hovering */
    

    etc.

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

Sidebar

Related Questions

I have a table like below image styled even/odd rows via css . Problem
I have the following CSS in my header: <style type=text/css> table, td { border-color:
I have an HTML table which is styled using CSS. The table is composed
The example is from a book. Table heading,Odd,even rows have different colors. It selects
I have a homepage.html and it refers to styles.css(makes a table). But I also
BACKGROUND: I would like to have small labels in columns of a table. I'm
I have the following CSS code for my HTML table, but for some reason
I have the following html files: <html> <head> <style type=text/css> .table-striped { padding: 0;
I have this table with some styled tds (I put screenshot because the content
I have a CSS that looks like this: CSS table { width: 100%; font-family:

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.