|
|
Killer Tables - Hard Returns
So, you thought you had mastered tables? You read all the
HTML specs at CERN, surfed the newsgroups, and browsed the hints pages. But
now, two hours before demo'ing your web-based gameboard concept to Milton
Bradley, something is horribly awry. The squares are not lining up in the
absolute positions you want them to. Your table-based gameboard is suffering
from...gaposis There is a
lightly documented bug in the way that tables have been implemented for the
Netscape browser. Carriage returns count. In casual usage, the bug may go
unnoticed. Yet, when absolute positioning is required, using them will create
gaps in an otherwise perfectly scripted table. Observe the following illustrations of the
problem: the Good Table, and the Bad Table. |
|
|
The cubes all stack right on top of each other. The
background does not show through in the slightest. In this example, all the
cell information follows immediately after the start of cell markup,
<td>. No carriage return. Additionally, the end of cell markup,
</td>, immediately follows the end of the cell contents. Again, no
carriage return.The definition for each cell in the table looks something like
this:
<td><cell_data></td>
Start of cell. Cell data.
End of cell. No carriage returns. |
|
|
The background that shows through between the table cells is
obvious. Even with border=0, cellspace=0 and cellpadding=0
in the table definition, the space between the cells will not get any tighter.
The carriage returns around the cell data do all the dirty work. In this
example, the definition for each cell looks something like this:
<td> <cell_data> </td>
Start of cell. Carriage
return. Cell data. Carriage return. End of cell. |
Check out the source for this page. Look closely at the good
and bad table scripts between the *'s. Carriage returns elsewhere in the table
do not create any disturbances. Only the ones around the cell definition cause
any trouble. |
|
Netscape discusses this abberation at the end of their
discussion on tables as implemented in Netscape 1.1. |
Back to Invisible Table Trick
|
|