[Netsurf-develop] Tabled widths

Richard Porter ricp at minijem.plus.com
Mon Jul 10 12:23:22 BST 2006


On 10 Jul 2006 Keith Hopper <kh at waikato.ac.nz> wrote:

> 
> In article <4e42e8c387lists-nospam at vigay.com>,
>    Paul Vigay <lists-nospam at vigay.com> wrote:
> 
>>  Does NetSurf need percentage table widths to be in quotes?
> 
>> eg. width="100%"
> 
>> or will it understand things like width=100% - even though this is
>> technically invalid HTML?
> 
>> This is because I've found a number of sites which look all scrunched
>> up with NetSurf, but view perfectly with other browsers.
> 
>> One such example is
>> http://www.spiritofmaat.com/archive/dec2/pringle.htm which is all in a
>> tiny little column on the left hand side.
> 
> According to W3C validator there are 73 errors in the document - so
> that might have something to do with the problem!

It's a horrible bit of html, but there's a problem in NetSurf. The 
name anchor tag is generating an extra table cell in the first row of 
the outer table. Paring the above page to the bone we have:

<html>
<head><title>title</title></head>
<body>
<table width=100% border=1>
<tr>
<a name="top">
<td width=17%>17</td>
<td width=80%>80</td>
<td width=3%>3</td>
</tr>
</table>
</body>
</html>

I've changed the border size to 1 so you can see what's happening.
When you display this (as an html file) in Netsurf you'll see an extra 
cell on the left with no cell border. Type some text after the anchor 
tag and it appears in this cell (note that the cell still has no 
border). Adding </a> makes no difference.

If you now delete the sixth line the table displays properly.

In the original page there's a second table row which doesn't line up 
because the 17% cell is under the phantom cell on the top row, the 80% 
cell is below the 17% cell and so on.

Now it doesn't make sense to put the anchor tag where it is and the 
validator should complain about it. Nevertheless NetSurf should be 
more defensive. Text inside a table but not inside a cell cannot be 
displayed as part of the table. Other browsers hold this text over 
until the end of the table instead of generating a spurious cell. The 
actual position of the name anchor is unpredictable, but there's no 
reason why it can't be set to the current position in the table.

The authors might argue about this behaviour, but in general it's best 
to do the same as the main web browsers where they're consistent.

-- 
 _
|_|. _   Richard Porter               http://www.minijem.plus.com/
|\_||_                                mailto:ricp at minijem.plus.com




More information about the netsurf-users mailing list