It's really a detail, so do not waste time on it unless you think it is interesting or funny. If so, try copy this code and view it in Opera, Mozilla and IE, if possible (no question is made in this posting)...
Code:
<HTML>
<HEAD>
<STYLE>
/* Overall styles. */
BODY {
background-color:#FFFFFF;
font-family:verdana;
}
TABLE {
background-color:#DDDDDD;
border-style:solid;
border-width:1px;
}
TD {
border-style:solid;
border-width:0px;
border-color:#000000;
}
INPUT {
border-style:solid;
border-width:1px;
border-color:#666666;
background-color:#EEEEEE;
font:bold;
}
TD.label {
text-align:right;
white-space:nowrap;
}
TD.control {
text-align:left;
}
.back {
text-align:right;
}
.next {
text-align:left;
}
/* For the first example where a single-cell-table
is used to surround the inner table. */
#contain {
padding:25px;
}
#container {
border-style:solid;
border-width:1px;
border-color:#444444;
}
/* For the layer example, where the table holding
the controls are surrounded by a layer */
#holder {
padding:25px;
border-style:solid;
border-width:1px;
border-color:#444444;
background-color:#DDDDDD;
width:1%;
}
</STYLE>
</HEAD>
<BODY>
<CENTER>
<TABLE ID='container' BORDER='0'>
<TR>
<TD ID='contain'>
<TABLE ID='page01' BORDER='0' >
<TR>
<TD CLASS='label'>your name</TD>
<TD CLASS='control'><INPUT type='text'></TD>
</TR>
<TR>
<TD CLASS='label'>your age</TD>
<TD CLASS='control'><INPUT type='text'></TD>
</TR>
<TR>
<TD CLASS='back'></TD>
<TD CLASS='next'><INPUT TYPE='button' value='next'></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</CENTER>
<BR>
<CENTER>
<DIV ID='holder'>
<TABLE ID='page01' BORDER='0' >
<TR>
<TD CLASS='label'>your name</TD>
<TD CLASS='control'><INPUT type='text'></TD>
</TR>
<TR>
<TD CLASS='label'>your age</TD>
<TD CLASS='control'><INPUT type='text'></TD>
</TR>
<TR>
<TD CLASS='back'></TD>
<TD CLASS='next'><INPUT TYPE='button' value='next'></TD>
</TR>
</TABLE>
</DIV>
</CENTER>
</BODY>
</HTML>
The example illustrates what I wanted to do; that is, to have some spacing between an outer border and some UI inside, where the controls are still close together (not using CELLPADDING or CELLSPACING). I have made a line around the inner UI so that the spacing is clear.
example 1 A one-cell-table surrounds the inner table holding the UI. Padding is set on the one-cell, and the border on the containing table. This will do the trick, and works fine in all the above browsers, however seem like a lot of tables; that is, doing a hole table structure for the sake of doing padding around another table.
example 2 A layer sourround the inner table holding the UI. All the styles related to this issue is applied to this layer. This construction however introduces new problems such as width of the layer (cannot simply have it to minimize around the inner table), wrapping of the labels (nowrap used in the example) and browser compapility.
Conclusion... I think that layers introduces a lot of trouble, even though it seems to be more simple to implement in the HTML code. I have to do the table structure with one cell in order to do what I want. The layer construction should be more flexible, or it could be that I simply do not know the right properties. It seems like a hassel to get layers to work properly and as expected.
Jacob.