Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

cannot fix the table width

cannot fix the table width

7:00 am on Dec 6, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 25, 2005
votes: 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.
7:47 am on Dec 6, 2005 (gmt 0)

Junior Member

joined:Mar 13, 2005
votes: 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.

5:58 am on Dec 7, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 21, 2002
votes: 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.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members