Column/Cell widths

  • Thread starter Thread starter Sjaakie
  • Start date Start date
S

Sjaakie

Hi all, not sure if there are any Microsoft IE programmers around, but I
wonder ...

Why is that Internet Explorer (and other browsers) use cell widths only
as a 'suggestion'? Eg whenever I try to create a table with a single
top-column (cellpadding=3), a 'body' of 3 normal columns and a single
bottom-column (again cellpadding=3), it doesn't pay attention to the
width=30 I address to the last 2 columns.

Cheers
 
Sjaakie said:
Hi all, not sure if there are any Microsoft IE programmers around, but I
wonder ...

Why is that Internet Explorer (and other browsers) use cell widths only
as a 'suggestion'? Eg whenever I try to create a table with a single
top-column (cellpadding=3), a 'body' of 3 normal columns and a single
bottom-column (again cellpadding=3), it doesn't pay attention to the
width=30 I address to the last 2 columns.

Cheers

Pretty hard to tell without seeing more of your HTML code. Are you using
the "colspan" parameter for your first row?

Coded width parameters are minimum widths, which may be extended if the
cell has wider content or additional width is needed to make the right
edge of the table line up. Normally widths would be specified for all
but one column, which would be allowed to expand to fit the remainder of
the table width.
 
RobertVA schreef:
Pretty hard to tell without seeing more of your HTML code. Are you using
the "colspan" parameter for your first row?

Coded width parameters are minimum widths, which may be extended if the
cell has wider content or additional width is needed to make the right
edge of the table line up. Normally widths would be specified for all
but one column, which would be allowed to expand to fit the remainder of
the table width.


The table is actually a, by ASP.NET generated, result of a DataGrid,
output looks pretty much like this (alhough ASP.NET tends to use
style="width:..." instead of the regular width-parameter):

<table width="100%">
<tr><td colspan="6">
<table width="100%">
<tr>
<td>...</td>
<td>...</td>
</tr>
</table>
</td></tr>
<!-- repeating -->
<tr>
<td width="50">...</td>
<td>...</td>
<td>...</td>
<td width="30">...</td>
<td width="30">...</td>
<td width="30">...</td>
</tr>
....
<!-- end repeating -->
<tr><td colspan="6">
<table width="100%">
<tr>
<td>...</td>
<td>...</td>
</tr>
</table>
</td></tr>
</table>

Both the first as well as the last 3 column get anywhere near the given
widths. Contents of those cells don't exceed the cell-width.

Sjaak
 
Sjaakie schreef:
RobertVA schreef:


The table is actually a, by ASP.NET generated, result of a DataGrid,
output looks pretty much like this (alhough ASP.NET tends to use
style="width:..." instead of the regular width-parameter):

<table width="100%">
<tr><td colspan="6">
<table width="100%">
<tr>
<td>...</td>
<td>...</td>
</tr>
</table>
</td></tr>
<!-- repeating -->
<tr>
<td width="50">...</td>
<td>...</td>
<td>...</td>
<td width="30">...</td>
<td width="30">...</td>
<td width="30">...</td>
</tr>
...
<!-- end repeating -->
<tr><td colspan="6">
<table width="100%">
<tr>
<td>...</td>
<td>...</td>
</tr>
</table>
</td></tr>
</table>


I 'solved' it by adding style='width:100%' to a column and 'nowrap' to
the others. This causes column-widths to be reduced to fit the contents
and the 'main' column to cover the resulting space.

I'm a pretty experienced webdeveloper, so I'm used to working around
these problems. So this isn't really an answer to my question. I
actually wanted to know why webbrowsers don't 'respect' the widths set
by the webdeveloper... there must be a good reason for this, since all
browsers act equally when it comes to cell-width and cellpadding.
 
Back
Top