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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:53:26+00:00 2026-06-09T20:53:26+00:00

I have a table whose second row ,first column contains another table. I want

  • 0

I have a table whose second row ,first column contains another table. I want to set a background color to the parent table rows but it should not be applied to child table rows. For that I am trying use CSS Child-selector (>).But its not working …Can anybody tel me the reason.

Here is my piece of code:

<!DOCTYPE HTML PUBLIC>
<html>
 <head>
   <style>
   table.tab > tr{
     background:red;
   }
  </style>
 </head>

 <body>
  <table class="tab">
   <tr>
    <td>asdf</td><td>afda</td><td>asdfdsa</td>
   </tr>

   <tr>
    <td colspan="3">
      <table>
       <tr>
          <td>afds</td><td>Trkaladf</td><td>inner Tab</td>
       </tr>
      </table>
    </td>
   </tr>

  </table>
 </body>
</html>
  • 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-09T20:53:27+00:00Added an answer on June 9, 2026 at 8:53 pm

    table.tab > tbody > tr indeed gives the style to only the first row.
    If you take a look at the DOM with firebug, you can confirm it. The first row of the child table doesn’t get styled the same way.

    However, since your child table is inside a table row that has a red background, and the child table has no background specified, the child table will have no background – and thus you still see the red background “through” the child table.

    Possible solution – styling the child table as well with a different background:

    table.tab > tbody >  tr {
     background:red;
    }
    
    table.tab table > tbody > tr{
     background:white;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a table which contains 5 column and query requirements: update row
I have a table whose primary key is a column named St_ID . I
I have a table with a column whose values come from an Enumeration. I
I have HTML table. I'm looping through table and iterate over each row whose
I have two table emptable1(empid,status) emptable2(empid,week) i want to select all the empid whose
I have a table that contains index data, with each row having a start
I have a table whose columns are varchar(50) and a float . I need
I have a table , half of whose cells are rowspan=2 and the other
I have table with around 70 000 rows. There is 6000 rows that i
I have table in which I am inserting rows for employee but next time

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.