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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:53:22+00:00 2026-05-27T00:53:22+00:00

<div id=top> <table> <tbody> <tr> <td>Cell number one content…</td> <td>Cell number two content…</td> </tr>

  • 0
<div id="top">
  <table>
    <tbody>
      <tr>
        <td>Cell number one content...</td>
        <td>Cell number two content...</td>
      </tr>
    <tbody>
  </table>
</div>

Presumably, this CSS should select the entire first cell blue and the second red:

  div#top table tbody tr:first-child {
      background-color:blue;
   }
   div#top table tbody tr + tr {
      background-color:red;
   }

Instead, this is what happens:
enter image description here

  • 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-27T00:53:23+00:00Added an answer on May 27, 2026 at 12:53 am

    Not quite. :first-child in your case means “a TR which is the FIRST CHILD of a TBODY”. it doesn’t mean “the first child element of a TR” (the TD).

    As such, you’re applying the blue to the table row, not the first td that happens to be a child of tr.

    if you want the first td only, then:

    div#top .... tr td:first-child { background-color: blue; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the HTML I am parsing: <div class=audio id=audio59779184_153635497_-28469067_16663> <table width=100% cellspacing=0 cellpadding=0><tbody><tr>
I am converting table structured data into div using below code. $('#content').html($('#content').html() .replace(/<tbody/gi, <div
I have two div's, one above the other and both have a table inside
i want to vertically align the second table to the top of the div.
I have a menu set up this way: <div id='top-navigation'> <ul> <li><a class='top-nav-button-unclicked' href='#'>SUBJECT</a></li>
A GWT tree looks roughly like this: <div class=gwt-Tree> <div style=padding-top: 3px; padding-right: 3px;
I have one horizontally div on the top of my page with a height
I have this html line: <div class=hide-btn top tip-s original-title=Close sidebar></div> And when a
i have this css : .table1 thead th:first-child{ -webkit-border-bottom-right-radius:8px; -webkit-border-top-right-radius:8px; -moz-border-radius:8px 0px 8px 0px;
I have one empty div: <div id=productlist class=productlist style=float:left;> </div> I appended the table

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.