#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0

    Question Table cell width not working


    I feel really stupid asking this question, but does anyone know why my cell widths don't go to 150px as I specify them?

    Code:
    <html>
    <head>
    <title>Test</title>
    <style>
    .customCell
    {
    	width: 150px;
    	text-align: center;
    	font-weight: bold;
    	border: 1px solid #ccc;
    	font-size: 11px; 
    	padding: 2px; 
    	background: #eee;
    }
    </style>
    </head>
    <body>
    <table cellspacing="0" cellpadding="0">
      <tr>
        <td class="customCell">12am</td>
        <td class="customCell">1am</td>
        <td class="customCell">2am</td>
        <td class="customCell">3am</td>
        <td class="customCell">4am</td>
        <td class="customCell">5am</td>
        <td class="customCell">6am</td>
        <td class="customCell">7am</td>
        <td class="customCell">8am</td>
        <td class="customCell">9am</td>
        <td class="customCell">10am</td>
        <td class="customCell">11am</td>
        <td class="customCell">12pm</td>
        <td class="customCell">1pm</td>
        <td class="customCell">2pm</td>
        <td class="customCell">3pm</td>
        <td class="customCell">4pm</td>
        <td class="customCell">5pm</td>
        <td class="customCell">6pm</td>
        <td class="customCell">7pm</td>
        <td class="customCell">8pm</td>
        <td class="customCell">9pm</td>
        <td class="customCell">10pm</td>
        <td class="customCell">11pm</td>
      </tr>
    </table>
    </body>
    </html>
    The cell widths just stay wide enouth to contain the content and don't expand to 150px. Any ideas why?
    Last edited by Kravvitz; September 1st, 2009 at 10:43 PM. Reason: fixed the code tags
  2. #2
  3. Thanks Johnny Hart (BC) R.I.P.

    Join Date
    May 2003
    Location
    Dallas
    Posts
    5,268
    Rep Power
    1956
    A table will try to fit the viewport. Give it a width, {width: 3600px;}

    cheers,

    gary
    There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

    My html and css workshop, demos and tutorials.
    Ask a better question, get a better answer.

IMN logo majestic logo threadwatch logo seochat tools logo