473,379 Members | 1,201 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,379 software developers and data experts.

Simple (hopefully) Table question

I'd like to alternate the rows in a table between having a shaded
background and being transparent to the background.

It's a table of people's names, phone numbers, and beeper numbers. So,
by having alternate rows be shaded, it will make it easier to read
which number in the leftmost column belongs to the name in the
rightmost column.

Are there basic html tags to allow shading alternate rows by the whole
table, rather than setting each one by hand? By that, I mean that
people move into and out of the group at a fairly good rate, so, is
there a tag I can put that covers the "whole" table and says
"alternate background effects in these rows" rather than hand-setting
the color of each background row?

I'm sure this could be handled by CGI, but, I'm looking for non-CGI
options to start.

Gwen
Jul 20 '05 #1
3 3077
Gwen Morse wrote:
I'd like to alternate the rows in a table between having a shaded
background and being transparent to the background. Are there basic html tags to allow shading alternate rows by the whole
table, rather than setting each one by hand?


No, and there shouldn't be. This is a presentational issue and therefore the
job of CSS. Unfortunatly CSS doesn't have anything that can alternative
styles (at least no yet), so you are limited to either using a lot of +
styles ( tr {} tr + tr {} tr + tr + tr {} etc ) which aren't supported by
MSIE, or giving class to every other <tr> element in the document.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #2
On Sun, 05 Oct 2003 23:50:30 -0400, Gwen Morse <go******@geocities.com>
wrote:
I'd like to alternate the rows in a table between having a shaded
background and being transparent to the background.

It's a table of people's names, phone numbers, and beeper numbers. So,
by having alternate rows be shaded, it will make it easier to read
which number in the leftmost column belongs to the name in the
rightmost column.

Are there basic html tags to allow shading alternate rows by the whole
table, rather than setting each one by hand? By that, I mean that
people move into and out of the group at a fairly good rate, so, is
there a tag I can put that covers the "whole" table and says
"alternate background effects in these rows" rather than hand-setting
the color of each background row?

I'm sure this could be handled by CGI, but, I'm looking for non-CGI
options to start.


As David has said, this can't be handled by HTML/CSS. If you will be
updating the table rather often, so that hand-editing is a nuisance, you
could have a look at batch editors such as sed. Writing a sed script to
do this sort of thing is a little fiddly (though it doesn't take long
once you've got used to using the 'x' command), but a lot less work than
setting up a server-side programming environment if you don't already
have one.

OTOH if you already have PHP available, that's probably the way to go.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #3
In article <4a********************************@4ax.com> in
comp.infosystems.www.authoring.html, Gwen Morse
<go******@geocities.com> wrote:
Are there basic html tags to allow shading alternate rows by the whole
table, rather than setting each one by hand?


No.

Either specify bgcolor in each td (_not_ tr), which is deprecated,
or set up some CSS (which _can_ be applied to rows).

Example -- in your HTML:

<table class="striped">
<tr><td ... ... </tr>
<tr class="otherstripe"><td ... ... </tr>
<tr><td ... ... </tr>
<tr class="otherstripe"><td ... ... </tr>
....
</table>

and then in your CSS file:

table.striped tr td {color:#000; background-color:#C33}
table.striped tr.otherstripe td {color:#000; background-color:#3C3}

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Preston Crawford | last post by:
I'm looking to quickly get a photo album online. Very simple, thumbnails, a few pages, maybe a description, but hopefully a small script that's easy to edit and work into my existing site. I know...
1
by: Scott | last post by:
The following is the XML I have to work with. Below is the question <Table0> <CaseID>102114</CaseID> <CaseNumber>1</CaseNumber> <DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>...
7
by: J. Hall | last post by:
Hi dudes, Got a simple webpage, with three numeric text input boxes, the idea being that the user is asked to insert percentages of their business around the world... UK, Europe, Other ...
3
by: Brad | last post by:
I have another hopefully simple question. I am so used to writing VB .Net windows apps that there are some things in ASP .Net that just does not easily cross over. I know how to pass variables to...
1
by: E.T. Grey | last post by:
I have been busting my nut over this for pretty much most of the day and it is driving me nuts. I posted this to an mySQL ng yesterday and I have not had any response (I'm pulling my hair out...
3
by: Laphan | last post by:
Hi All I know that I should supply the DDL for the tables I'm going to talk about, but I'm not 100% on how to generate them just yet. Hopefully my question is more a query methodology question...
3
by: prophet | last post by:
I know that this is going to be so simple to fix, but I have been pulling my hair out trying to see the forest through the trees...... What I want to do is change the onMouseOver so that when you...
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
1
by: Andrew | last post by:
I'm learning PHP so this might be a simple question to more expeienced developers hopefully. I have a findrecords.php page which has the following code which creates a new record in a database...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.