Solved

Style to set color for table row

Posted on 2008-06-09
6
360 Views
Last Modified: 2012-05-05
I have the following style set up to make the font color red for the row, but it's not changing the color - any ideas why not?
<tr style="color:Red; " onMouseOver="style.background='#ffff77';" onMouseOut="style.background='';">

  <td valign="top">Joe Bloggs</td>

...

</tr>

Open in new window

0
Comment
Question by:Terry Woods
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:tomaugerdotcom
Comment Utility
since TR cannot contain text, you can't use the color style there. try these things:

<tr onMouseOver etc....><td style="vertical-align:top; color: red;">Joe Bloggs</td>...</tr>
0
 
LVL 14

Expert Comment

by:tomaugerdotcom
Comment Utility
or, better, stay away from inline styles altogether:

<table id="myTable">
  <tr onMouseOver.....>
    <td>Joe Bloggs</td>
.....
  </tr>
....
</table>

<style type="text/css">
    table#myTable td { vertical-align:top; color:red; }
</style>
0
 
LVL 35

Author Comment

by:Terry Woods
Comment Utility
There are more cells in the table row, and I want the whole row to have red text with minimal style code. But not every row is to have red text. If I use a style sheet, will I need to (say) specify a css class for each cell in the rows that need red text?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 42

Expert Comment

by:David S.
Comment Utility
You could apply a class to each row instead of each cell.
0
 
LVL 14

Accepted Solution

by:
tomaugerdotcom earned 300 total points
Comment Utility
I'm going to simplify the code a bit to save time
<table id="myTable">
 <tr class="redRow">
   <td>Red stuff</td>
 </tr>
 <tr>
   <td>This stuff is not red</td>
  </tr>
</table>

the stylesheet for this would be
table#myTable tr.redRow td { color:red; etc...}
0
 
LVL 35

Author Comment

by:Terry Woods
Comment Utility
Just what I needed - thanks so much for the quick response!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now