setting table column attributes

P

ppcguy

is there a way to set table column attributes (e.g. background-color)
just once...as opposed to going into each <TD> for that column.

css preferable.
 
T

Toby Inkster

ppcguy said:
is there a way to set table column attributes (e.g. background-color)
just once...as opposed to going into each <TD> for that column.

No -- table inheritance only works for rows.

So you can, for example, set the background for every cell in a particular
row, like this:

<style type="text/css">
TR.yellowrow TD { background:yellow }
</style>

<tr class="yellowrow">
<td>a</td>
<td>b</td>
<td>c</td>
</tr>

However, you can use the <colgroup> and <col> elements near the top of
your table to set border colours, widths and styles, and default
alignments.
 
N

Neredbojias

With neither quill nor qualm, ppcguy quothed:
is there a way to set table column attributes (e.g. background-color)
just once...as opposed to going into each <TD> for that column.

css preferable.

Yes if you class the td's and set class color in the style sheet. This
is assuming you want different colors for different columns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top