Give individual cell's a border?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Harry

    Give individual cell's a border?

    I would like to have just the top row cells of a table to have borders - is
    this possible/easy? or do I have to make the title row another table?

    thanks

    harry


  • Evertjan.

    #2
    Re: Give individual cell's a border?

    Harry wrote on 23 okt 2003 in comp.lang.javas cript:[color=blue]
    > I would like to have just the top row cells of a table to have borders
    > - is this possible/easy? or do I have to make the title row another
    > table?[/color]

    No js, just css:

    <style>
    tr.frst td {border:green solid 1px;}
    </style>

    <table>
    <tr class="frst"><t d>x</td><td>y</td></tr>
    <tr> <td>x</td><td>y</td></tr>
    </table>



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Give individual cell's a border?

      Evertjan. wrote:
      [color=blue]
      > Harry wrote on 23 okt 2003 in comp.lang.javas cript:[color=green]
      >> I would like to have just the top row cells of a table to have borders
      >> - is this possible/easy? or do I have to make the title row another
      >> table?[/color]
      >
      > No js, just css:[/color]

      ACK
      [color=blue]
      > <style>
      > tr.frst td {border:green solid 1px;}
      > </style>
      >
      > <table>
      > <tr class="frst"><t d>x</td><td>y</td></tr>
      > <tr> <td>x</td><td>y</td></tr>
      > </table>[/color]

      <head>
      ...
      <style type="text/css">
      tr:first-child td {
      border:green solid 1px;
      }
      ...
      </style>
      ...
      </head>
      <body>
      ...
      <table>
      <tr>
      <td>x</td>
      <td>y</td>
      </tr>
      <tr>
      <td>x</td>
      <td>y</td>
      </tr>
      ...
      </table>
      ...
      </body>

      But I assume the top row cells are table heads, so it would
      be better to use and format `th' elements instead like

      <head>
      ...
      <style type="text/css">
      th {
      border:green solid 1px;
      }
      ...
      </style>
      ...
      </head>
      <body>
      ...
      <table>
      <thead>
      <tr>
      <th>x</th>
      <th>y</th>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td>x</td>
      <td>y</td>
      </tr>
      ...
      </tbody>
      </table>
      ...
      </body>


      HTH

      PointedEars, X-Post & F'up2 comp.infosystem s.www.authoring.stylesheets

      Comment

      Working...