Previous Message
Next Message

Alternating row colors in table

Sent by Stephen R Laniel on 5 September 2005 18:06


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


--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=
=20
> than the <td> tags, but I'm not sure how to designate that in the css. =
=20
> 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">
=2E..
</table>

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'.

Alistapart.com tackled this a while ago with Zebra Tables:
http://www.alistapart.com/articles/zebratables/

See if that does what you want.

--=20
Stephen R. Laniel
[EMAIL-REMOVED]
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDHHh4Ha1lzVGot+YRAvmYAKCLNuQCqFGFcEgOP5HszChR8ZUviQCeKwxT
Ezoyrf2081AqEqq3/KYSnhg=
=OZEU
-----END PGP SIGNATURE-----

--IS0zKkzwUGydFO0o--

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

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

--===============92104607853848508==--
Previous Message
Next Message

Message thread: