Using different widths for table cells.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    Using different widths for table cells.

    Ello.

    I'm trying to set the widths for my first three rows of cells and then have a bottom row with different cell widths. However, the first three rows take on the same widths as the bottom row.

    Code:
    <table>
      <tr>
        <td width="80%"> ... </td>
        <td width="20%"> ... </td>
      </tr>
      <!-- 2 more rows like this. -->
      <tr>
        <td width="50%"> ... </td>
        <td width="50%"> ... </td>
      </tr>
    </table>
    Is there a way to do the above and have them retain their specified widths?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Yep. That's what tables do. Cause they're a table.

    You can create more cells and combine cells together but you can't have variable width tables as you show. That's not what tables are for. Tables are never to be used for layout.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Of course. I was using them to straighten up the edges of a form, n what not.

      Nevermind.

      Thanks, doc.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by Markus
        I was using them to straighten up the edges of a form, n what not.
        isn't that what layout is about?

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by Dormilich
          isn't that what layout is about?
          It's much easier to

          Code:
          <table>
            <tr>
              <td><input ... ></td>
              <td>Username</td>
            </tr>
            <tr>
              <td><input ... ></td>
              <td>Password</td>
            </tr>
          </table>
          rather than using divs to keep everything aligned.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            what about floating the labels?

            Comment

            • drhowarddrfine
              Recognized Expert Expert
              • Sep 2006
              • 7434

              #7
              Why would you need divs to keep it aligned. I never do so.

              Comment

              Working...