Previous Message
Next Message

Alternating row colors in table

Sent by Stephen R Laniel on 5 September 2005 17:05

Content-Disposition: inline
content-type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature"; boundary="IS0zKkzwUGydFO0o"

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 05, 2005 at 10:41:34AM -0600, JJ wrote:
> I'm trying to setup styles for a simple table that will allow me to=20
> easily alternate row colors.  For simplicity in programming the page=20
> generation, I'd ideally like to apply the style to the <tr> tags rather=
> than the <td> tags, but I'm not sure how to designate that in the css. =
> Is this possible?

I suspect what you'll want to do is set up an 'oddrows'
class and an 'evenrows' class, a la

=2Eoddrows {
	background-color: blue;

=2Eevenrows {
	background-color: white;

then give the table a unique ID, a la

<table id=3D"alternatingrows">

then write a little Javascript to

1) find the unique element with the ID "alternatingrows".
2) iterate over the rows in that element, alternately
   labeling them 'even' or 'odd'. tackled this a while ago with Zebra Tables:

See if that does what you want.

Stephen R. Laniel
+(617) 308-5571
PGP key:

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

Version: GnuPG v1.4.1 (GNU/Linux)



Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --

Previous Message
Next Message

Message thread: