How to set up a Table

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

    How to set up a Table

    Hi there

    I have one table. It is called links and looks like this:

    <table id="links">
    <!-- loop -->
    <tr>
    <td width="50%">ite m 1</td>
    <td width="50%">ite m 2</td>
    </tr>
    <!-- end loop -->
    </table>

    (the items comes from a database and this loop goes on as long as data
    is available)
    ------------------

    For the stylesheet i have:

    table#links {
    width:505px;
    margin:20px 20px 0px 40px;
    }

    tr#links {

    }

    table#links td{
    width:50%
    font-family: arial, verdana ,sans-serif;
    font-size:80%;
    margin:0;
    font-weight:normal;
    line-height:170%;
    color:#0066CC;
    }

    table#links a:link {
    color: #0066CC;
    text-decoration: normal;
    }

    table#links a:visited {
    color: #062D51;
    text-decoration: normal;
    }

    table#links a:hover {
    color: #0066CC;
    text-decoration: normal;
    }

    Okay, this works alright :)

    My question is only if this is correct CSS. It validates alright, but i
    am a bit confused over this part:

    table#links

    Is this the only way to describe my table or is there a better way?

    Mark

  • 'sNiek

    #2
    Re: How to set up a Table

    Mark schreef:[color=blue]
    > My question is only if this is correct CSS. It validates alright, but i
    > am a bit confused over this part:
    >
    > table#links
    >
    > Is this the only way to describe my table or is there a better way?
    >
    > Mark
    >[/color]


    It's the best way to do that, it looks good, just a few minor 'errors':

    1. In the HTML, you can delete the width="50%" part:
    <table id="links">
    <!-- loop -->
    <tr><td>item 1</td><td>item 2</td></tr>
    <!-- end loop -->
    </table>

    2. In the table#links td-part you forgot the ; at the end of width:50%
    table#links td{
    width:50%;

    3. The part: tr#links {} must be: table#links tr {}
    But it's emty so that doesn't matter



    --
    Niek

    Comment

    • Mark

      #3
      Re: How to set up a Table

      'sNiek wrote:[color=blue]
      > Mark schreef:
      >[color=green]
      >> My question is only if this is correct CSS. It validates alright, but
      >> i am a bit confused over this part:
      >>
      >> table#links
      >>
      >> Is this the only way to describe my table or is there a better way?
      >>
      >> Mark
      >>[/color]
      >
      >
      > It's the best way to do that, it looks good, just a few minor 'errors':
      >
      > 1. In the HTML, you can delete the width="50%" part:
      > <table id="links">
      > <!-- loop -->
      > <tr><td>item 1</td><td>item 2</td></tr>
      > <!-- end loop -->
      > </table>
      >
      > 2. In the table#links td-part you forgot the ; at the end of width:50%
      > table#links td{
      > width:50%;
      >
      > 3. The part: tr#links {} must be: table#links tr {}
      > But it's emty so that doesn't matter
      >
      >
      >[/color]

      :) Ok, thanks a lot!

      Mark

      Comment

      Working...