homepage Welcome to WebmasterWorld Guest from
Pubcon Platinum Sponsor 2014
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

cannot fix the table width
cannot fix the table width

5+ Year Member

Msg#: 11460 posted 7:00 am on Dec 6, 2005 (gmt 0)

I'm trying to fix the table width but it can't.I fixed inside the code using width="15" or something like that. But when i view in the browser it still looks like width="50" . How can i fix that problem? Please let me know. Thank you.



Msg#: 11460 posted 7:47 am on Dec 6, 2005 (gmt 0)

Perhaps you need to do some checking in the cells, the width of the cells can not exceed the width of the table, so for example:

<table width="10">
<tr><td width="50">

Will unfortunately over-ride your table width and come out as a 50-width table due to the cell's width.

Also for tables with more than one cell, you need to add the width of all the cells in a row, column after column, to make sure no row of cells exceeds the table's total width.
Find the first <tr> NOW add ALL the <td width='s> until you get to the first </tr>, then that is your sum per row.
Do this for every <tr> -to- </tr> (your rows) and add the widths of the <td's> (your columns).

If this is not the problem, I am sorry to have wasted your time.

Purple Martin

WebmasterWorld Senior Member 10+ Year Member

Msg#: 11460 posted 5:58 am on Dec 7, 2005 (gmt 0)

Tables expand automatically to fit their content. They are supposed to do that. So if you have a cell that is wider than the table then the table will grow to accomodate it (as in topsites' example), also if the contents of any cell is wider than the table then the table will grow to acommodate the table.

It's worth remembering what an HTML table was originally designed for: it was designed to hold tabular data, and therefore it is appropriate for a table to grow to fit the content we put in it. Tables were not designed for layout and therefore it is inappropriate for us to try to assign a specific width to a table. We should use div tags with CSS for layout and assign them whatever width we like, and we should use tables for displaying tabular data and allow them to grow to whatever width is natural for the data in the tables. Of course, this is how it should be in an ideal world, and the real world we live in is seldom ideal.

Global Options:
 top home search open messages active posts  

rss feed

WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved