|
Posted by Jukka K. Korpela on 11/07/06 06:12
Scripsit cho.cabot:
> Is there a way to create a table that does the following:
>
> - has columns with alternating color backgrounds
Just use
<col>
<col class="even">
<col>
<col class="even">
etc.
as needed to cover all the columns (no, there's no shortcut) in HTML, right
after the <caption> element, before the <thead> element, and something like
the following in CSS:
col { background: white; color: black; }
col.even { background: #ffc; color: black; }
> - has a cell with a colspan of 2 and contains an image with a
> transparent background that still maintains the alternating background
> colors of the columns
That sounds somewhat weird, but maybe there's a reason. Anyway, since such a
cell spans two columns, the column structure is continued after it as if it
had been two cells. So if, say, the 2nd cell of a row has colspan="2", then
the cell itself counts as being in an even column (according to _first_
column of the span), and the next cell of that row will be in an even column
too, since it is counted as the 4th cell. Thus, there will be two adjacent
cells with the same (even column) background, and after that, things go on
normally, so that the pattern of column background alteration is not
disturbed. It is impossible for me to guess whether this is what you mean by
"still maintains the alternating background colors of the columns". You
cannot, of course maintain it both for the table as a whole and for the two
adjacent cells, after breaking the normal "flow" of columns.
I'm not sure what the expression "with a transparent background" refers to.
The image? If it has transparent parts, then the background of the image
itself may be significant, but it's normally transparent by default, i.e. in
this case the background of the cell shines through. You can of course
explicitly set background: transparent for the cell, without affecting
anything else, but then you'll get whatever happens to be the table's
background _or_ the column's background. Browsers disagree on this.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|