setting table column attributes

Discussion in 'HTML' started by ppcguy, Aug 13, 2005.

  1. ppcguy

    ppcguy Guest

    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.
     
    ppcguy, Aug 13, 2005
    #1
    1. Advertising

  2. ppcguy

    Toby Inkster Guest

    ppcguy wrote:

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

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Aug 13, 2005
    #2
    1. Advertising

  3. ppcguy wrote:

    > is there a way to set table column attributes (e.g. background-color)
    > just once...


    No.

    > as opposed to going into each <TD> for that column.
    >
    > css preferable.


    Well you can set CSS properties, but they aren't attributes :)

    http://css-discuss.incutio.com/?page=StylingColumns

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Aug 13, 2005
    #3
  4. ppcguy

    Neredbojias Guest

    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.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Aug 14, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. savvy
    Replies:
    1
    Views:
    494
    savvy
    Jan 18, 2006
  2. AwanJohnie
    Replies:
    1
    Views:
    551
    Joris Gillis
    Oct 2, 2004
  3. Charleees
    Replies:
    2
    Views:
    8,278
    Eliyahu Goldin
    Jun 20, 2006
  4. Greg Smith
    Replies:
    0
    Views:
    552
    Greg Smith
    Apr 12, 2007
  5. Greg Smith
    Replies:
    0
    Views:
    171
    Greg Smith
    Apr 12, 2007
Loading...

Share This Page