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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:29:45+00:00 2026-06-05T14:29:45+00:00

I use css to set the background to the cell but it does not

  • 0

I use css to set the background to the cell but it does not apply to the whole cell.

I am trying to set the background image to First and last <TR>, but it’s showing like this.

I am trying to apply .first class property for first and last <tr>. What should I do so it applies to TR?

 <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">

 .excel{
         background:url(smallimage/excel.jpg);
          background-size:24px 24px;
          background-repeat:no-repeat;
          position: relative;
           margin:3px;
           left: 2px;
            top: 1px;
        }


        td.yellostar{
        background-image: url(smallimage/yellowstar.jpg);  /* forward slash for the path */
        width: 20px; /* use you own image size; */
        height: 20px; /* use you own image size; */
        background-repeat: no-repeat;
        background-position: center;
        text-align: center;
        vertical-align: top;
        } 
        .first{
        background-image:url(smallimage/trbackgr.jpg);
        background-repeat: repeat-x;
        }

    </style>
    </head>

    <body>
    <table width="95%" border="1" cellspacing="0" cellpadding="0">
        <tr class="first">
        <th colspan="2" class="first">chapter #|chapter Name</th>
        <th>Linkage</th>
        <th>project<br/>count</th>
        <th>Task<br>count</th>
        <th>issues<br> Open/All</th>
        <th>Action</th>

      </tr>
        <tr >
        <td>05</td>
        <td><div class="excel" > &nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u>Chapter 5:Data of Information</div></td>
        <td class="yellostar" ></td>
        <td><p align="center">3</p></td>
        <td><p align="center">21</p>
        </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>06</td>
        <td><div class="excel">&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u>Chapter 6:Data Tabels and Amortization Tabels</div></td>
        <td class="yellostar">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>07</td>
        <td><div class="excel" >&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u>Chapter 7:Data consolidation,Links and Formula Auditing</div></td>
        <td class="yellostar">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>08</td>
        <td><div class="excel" >&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u></td>
        <td class="yellostar">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>09</td>
        <td><div class="excel" >&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u></div></td>
        <td class="yellostar">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>10</td>
        <td><div class="excel" >&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<u></div></td>
        <td class="yellostar">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr class="first">


        <td colspan="7" class="first" >&nbsp;</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-05T14:29:46+00:00Added an answer on June 5, 2026 at 2:29 pm

    You can use pseudoclasses :first-child and :last-child .
    Look at my example: jsfiddle

    But :last-child is not cross-browser, fixes will be needed for IE.

    And you have an error in specifying the reference image for background w3schools.

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

Sidebar

Related Questions

First, I use JQuery to set the background image. Then, I add the class
So I am trying to use the CSS hack to set the max-height for
I just wonder if it is possible to only use CSS but not javascript
This is driving me nuts. I am trying to set a background image to
I defined two CSS classes that set the background to an image (shown below).
When you use a background image and set the src are you making that
I'm looking for a way to use CSS to style everything between the first
i use the following to to set the text content of an css element
I want to generate tooltip based on a dynamically changing background image in css.
I have a background image, 1000x666px, and only 93kb. I use it as a

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.