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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:42:58+00:00 2026-06-15T03:42:58+00:00

I have a css problem. I got an table inside anther table. each table

  • 0

I have a css problem. I got an table inside anther table. each table have a different color (depending data inside). So I put a class for each table. but the color depend when the class is set on css. I mean if color 1 is declare before the second, it will override the child color.

I made a sample : http://jsfiddle.net/b8T6V/2/ (complete version)

 <table border="0" class="Grid0">
        <tr class="even">
                    <td>table 1, row 1</td>       
        </tr>
        <tr class="even">
            <td>
                <table border="0" class="Grid1">
                    <tr class="even">
                        <td>table 2, row 1</td>       
                    </tr>
                    <tr class="odd">
                        <td>table 2, row 2</td>       
                    </tr>
                </table>
            </td>        
        </tr>
        <tr class="odd">
            <td>table 1, row 2</td>       
        </tr>
        <tr class="odd">
             <td>
                <table border="0" class="Grid1">
                    <tr class="even">
                        <td>table 2, row 1</td>       
                    </tr>
                    <tr class="odd">
                        <td>table 2, row 2</td>       
                    </tr>
                </table>
            </td>     
        </tr>
    </table> 


table.Grid0 tr.even
{
    background-color: RED ;
}
table.Grid0 tr.odd
{
    background-color: BLUE;
}

table.Grid1 tr.even
{
    background-color: BLACK;
}
table.Grid1 tr.odd
{
    background-color: WHITE;  /*background-color: blue;*/
}

If you use Grid1 instead of Grid0, and Grid0 instead of Grid1. That will not work.

jsfiddle sample:

The first table start with Grid0 and the second with Grid1. The second should have table in red/blue.

Thank you for your help

  • 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-15T03:42:59+00:00Added an answer on June 15, 2026 at 3:42 am

    Because your inner tr is inside two tables, one of class Grid0 and one of class Grid1 then both sets of CSS rules apply, so (since they appear later on in the file) the back/white background colours take precedence.

    The easiest way to fix this is to insert > tbody > in to all of the relevant rules, so that only the class of the parent table is considered and not any other ancestor tables.

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

Sidebar

Related Questions

I have a strange problem working with HTML,CSS in different browsers: Firefox 3.6 and
im creating a slider body but got a problem. I have a next previous
I got a problem with CSS styling of a page. Basically I have a
I have got a css problem. http://www.luukratief-design.nl/dump/parallax/index.html I cant get this page to align
I've got a problem in my CSS layout where, I have a container which
Have got a problem getting jQueryUI working / initialising a basic button inside of
I have created a menu. It's pretty basic but I got a problem which
I have got ot the following css to make my table cell's background transparent
I have a horizontal CSS menu. The problem is when the user creates more
I have a problem with my CSS on a website I'm working on .

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.