473,221 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

Alternative color in table row by css

12
Hi All,

I want to ask is any method to define one class of css to make the table with alternative color with row of table. (without using javascript or server side language)

For example :
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bg">&nbsp;</td>
</tr>
<tr>
<td class="bg">&nbsp;</td>
</tr>
<tr>
<td class="bg">&nbsp;</td>
</tr>
<tr>
<td class="bg">&nbsp;</td>
</tr>
</table>


Thanks and Regards,
stepby
Aug 29 '07 #1
1 4180
phvfl
173 Expert 100+
Hi,

The easiest way to do this would be to add a class to alternate rows, for example:
[HTML]
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bg">&nbsp;</td>
</tr>
<tr class="alt">
<td class="bg">&nbsp;</td>
</tr>
<tr>
<td class="bg">&nbsp;</td>
</tr>
<tr class="alt">
<td class="bg">&nbsp;</td>
</tr>
</table>
[/HTML]

Expand|Select|Wrap|Line Numbers
  1. .alt{background-color:#FF0000;}
  2.  
This example would turn the background colour of alternate rows red, assuming that the bg class did not also set the background colour
Aug 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

99
by: Paul McGuire | last post by:
There are a number of messages on the python-dev mail list that indicate that Guido is looking for some concensus to come from this list as to what *one* alternative syntax for decorators we would...
20
by: Tammy | last post by:
What would be a good alternative to using frames? I need something that will section my webpage into two halves and can change both frames on a single click. Thanks in Advance, Tammy
3
by: Billy | last post by:
I wish to select a node using the value of one of its attributes, i.e. xml: .... <tablelist> <table name="table1"> ... </table> <table name="table2"> ...
15
by: Steffen Ramlow | last post by:
Hi there, is there any way besides a trigger to create a unique number for a column in a "insert into... select from" statement? Thx, sr -- Kein Plan überlebt die erste Feindberührung.
13
by: Mark | last post by:
I am looking for a switchboard creator alternative for my MDB. Can anyone help me? Thanks for your help, Mark
10
by: WJA | last post by:
I'm looking at building an application that needs to display 4 levels of hierarchical data. Initially the obvious choice for this would seem to be the treeview control. After searching this...
2
by: chrisoftoday | last post by:
Firstly, I know there's a lot of old posts on this topic but none seem to be relevant to my problem (selecting from a single table rather than several different tables)... I have a table with a...
5
by: Phuff | last post by:
Hey all, I need some direction help. I have a switch case statement that is seemingly my only option right now, but its too large and not easy to maintain the code. Here goes... I have part...
6
by: C10B | last post by:
hi, I have a table with several million rows. Each row is simply the date and time a certain page was viewed. eg page1 1-1-00 page2 2-1-00 page1 16-1-00 page1 17-1-00
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.