Results 1 to 3 of 3

Thread: trouble controling cell width

  1. #1
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default trouble controling cell width

    I have a table that looks like this:

    Code:
    <table style="height: 100%;" cellspacing=0 cellpadding=0 border=1>
    
    <tr><td colspan=2 style="height: 100px;">
    <center>
    <span style="font-size: 24pt; text-align: center;">
    <img src="H&R banner.jpg" border=0></span></center></td></tr>
    
    <tr>
    
    <td style="width: 200px;">
    <center>
    <span style="text-align: center;">
    MARGIN<br>
    (latest news)<br>
    (possibly links)
    </span>
    </center>
    </td>
    
    <td>
    <table style="width: 100%; height: 100%" cellspacing=0 cellpadding=0 border=1>
    <tr>
    <td style="height: 50px;">
    <center>
    <span style="font-size: 14pt;">menu bar</span>
    </center></td>
    </tr>
    <tr>
    <td>
    <center>
    <span style="font-size: 24pt; text-align: center;">
    CONTENT
    </span>
    </center>
    </td>
    </tr>
    </table>
    </td>
    
    </tr>
    </table>
    I'm having trouble controling the width of the first bolded table cell. This happens in IE9. I have it set to 200px, but for some reason it wants to be wider than that (I can tell because the text seems to be centering within the first 200px of its width, but it's not centered within the whole cell). I can fix this by specifying a % width (as in style="width: 25%;"), but I'd prefer to stay away from percentages. I can also fix the problem by specifying the width of the next cell (to its right, in bold above) to some specific value, but then this fixes the size of the whole table, and I would like to keep it variable.

    Does anyone know why the width likes to increase to more than I specified, and if so, how do I fix this problem?

  2. #2
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    1. i recommend you to change that font-size from pt to px.
    2. this <center></center> and <span style="text-align: center;"></span> you don't need this, just place align="center" in <td></td>
    _____________________

    David Demetrius // davejob
    _____________________

  3. #3
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    I made the changes you recommended but unfortunately it didn't help.

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
  •