/    Sign up×
Community /Pin to ProfileBookmark

color each row in a table

Hi,

How can one color every row in a table to be of a different color? That is, can something be done to each pair of <TR> ….. </TR> and assign it a color?

Thanks!

DL

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@nataliemacMay 29.2006 — Yes, you can.

The zebra tables link posted above is a great way to make a table striped between two alternating colors.

If you want different colors for each row, use CSS to set a class for each <tr> element, then use CSS to set the background-color attribute of each cell in that row.

For example:

[CODE]<tr class="red">
<td>Content</td>
<td>Content</td>
<td>Content</td>
</tr>

CSS:

tr.red td {
background-color: #FF0000;
}[/CODE]


Good luck,

Natalie
Copy linkTweet thisAlerts:
@datalineauthorMay 30.2006 — Thank you both Tree and Natalie! Will give it a try!

DL.
×

Success!

Help @dataline spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...