SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Dec 2010
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Table cell box model: extra width and height

    Here's the table cell: https://developers.google.com/+/web/...harelink-sizes

    table-cell-screenshot.jpg

    As you see when you use the inspect element feature in Chrome or Firefox, the total width and height of the table cell is calculated as 105px 85px. However, the cell content (image) is only 64px 64px and the cell padding is 6px 10px 6px 10px. I don't see any width and height properties in the element style, so where does this extra width and height come from?

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    From CSS apparently:

    body.docs table th, body.docs table td {
    padding: 6px 10px;
    }

    screen-docs.css line 1 (probably minified, I copied this out of Opera dragonfly)

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,546
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I may have misunderstood the question but table cells are distributed across the width of the table in a best fit approach for the content that is seen. It doesn't shrink wrap all content when the table is at 100% width because the table would no longer be 100% wide then.

    You could force the issue by setting a width on that column (put a width on the th for that column) and then the browser will obey that width as long as it fits in with the other cells otherwise the browser will adjust accordingly. Or you could use the table-layout fixed property/value and then size each of the columns exactly as you want (as long as they again add up to the total available space).

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Ah, no, I'm the one who misunderstood the question!


Tags for this Thread

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
  •