SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question strange table behavior

    Hi,

    i have the following code:
    Code:
    <table width="100%" align="center">
      <tbody>
        <tr>
          <td valign="top">
            <div class="product_name"></div>
            <div class="product_image"></div>
            <div class="product_price"></div>
            <div class="product_add2cart"></div>
          </td>
          <td valign="top">
            <div class="product_name"></div>
            <div class="product_image"></div>
            <div class="product_price"></div>
            <div class="product_add2cart"></div>
          </td>
        </tr>
      </tbody>
    </table>
    under FF firebuf i get the following CSS results:
    table:
    width=598px;

    tbody, tr:
    width=594px;

    td:
    width=147px;

    1. how is it possible that tbody and table have not the same width ?
    i have no border define ( border : 0px

    2. how is it possible that sum of 4 <td> width is not equal to <tr> width ?
    4x147 = 588 px; and not 594px;

    td width is set into a CSS file to 145px :-(
    in each <td> there are 4 div all with width=145px; :-(

    i'm confused now where is the mistake.

    thx.

  2. #2
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i discovered that i missed float: left; for each <td>
    now it works correctly.

  3. #3
    Non-Member
    Join Date
    Jun 2010
    Location
    4727′35″N 2618′0″E
    Posts
    1,789
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or probably you've missed cellspacing and border collapse?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •