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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:28:44+00:00 2026-06-14T08:28:44+00:00

I have a simple table with several rows. The top rows contains headings, while

  • 0

I have a simple table with several rows. The top rows contains headings, while the rows under it have the id attribute of data. I have been trying to set CSS for the table rows that only have the id attribute data, but have so far only been able to set it for the entire table.

<table width = "80%" align="center" id="example">
<tr>
<td><h3>ID</h3></td>
<td><h3>First Name</h3></td>
<td><h3>Last Name</h3></td>
</tr>
<tr id="data">
<td>1</td>
<td>Joe</td>
<td>Schmoe## Heading ##</h3><td>
</tr>
</table>

and the CSS. I tried changing #example tr to tr #data with no luck. I know that I am overlooking something simple, but I am unsure what.

table#example {
    border-collapse: collapse;   
}
tr #data{
    background-color: #eee;
    border-top: 1px solid #fff;
}
tr #data:hover {
    background-color: #ccc;
}
tr #data {
    background-color: #fff;
}
tr #data th, tr #data td {
    padding: 3px 5px;
}
tr #data td:hover {
    cursor: pointer;
}

I’m not using classes because I’m not familiar enough with CSS and being able to use id only once is not a limitation for what I need.

  • 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-14T08:28:45+00:00Added an answer on June 14, 2026 at 8:28 am

    You could use a class, but better yet, don’t use classes at all (HTML markup is your friend)! Here’s a clean solution to your problem:

    HTML

    <table>
        <tr>
            <th>ID</th>
            <th>First Name</th>
            <th>Last Name</th>
        </tr>
        <tr>
            <td>1</td>
            <td>Joe</td>
            <td>Schmoe</td>
        </tr>
    </table>
    

    CSS

    th {
      font-weight: bold;
      /* More styles here */
    }
    
    td {
      background: #EEE;
      border-top: 1px solid #FFF;
    }
    
    tr:hover td {
      cursor: pointer;
      background: #CCC;
    }
    
    /* Styles upon styles */
    

    Simply use the th element to specify the table header. To get each table data row to highlight as you mouse over it, simply use the tr:hover td rule to catch that case. See this fiddle for a working example.

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

Sidebar

Related Questions

I have a table that contains several thousand rows, having a Varchar column that
I have a simple html table which has several rows. the following is implemented
I have a simple table. The first column has max-width set at 15px. It
I have a StoredProcedure that returns a simple table containing several records: DECLARE @STEPS_TABLE
I have a data frame with several rows and I want to create a
I have a html table which has several rows - lets say 17 for
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple table creating script in Postgres 9.1. I need it to create
I have a simple table that has this structure: <table> <thead> <tr> <td>Some info</td>
I have a simple table maintaining messages between users. The table structure looks like

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.