Haha! I apologize for taking so long to get these examples to you. I've been in the rush leading up to finals at uni for the past month or so. (And thanks again for the work you've done on the adapters! My fellow student workers and I were having to write a lot of code by hand since the controls output HTML we couldn't use. I asked my boss "What's the point of using .NET then?" one day... and guess who got the project to adapt all of the controls? =P Anyway, since then it's been a huge time saver to be able to use the built-in ASP.NET controls.)
Alright, here's the relevant part of the sample.css file:
/* This is the main "same line CSS" */
form dl, form fieldset dl, form div dl {
float: left;
width: 100%; /* Only necessary for IE */
padding: 0;
padding-bottom: 1px;
}
form dt, form div dt {
margin: 0 5px 5px 0;
clear: both;
float: left;
text-align: right;
width: 150px; /* To avoid IE bug, the width of dt is set below width of any column */
}
form dd, form div dd {
margin: 0 0 10px 0;
float: left;
width: 80%; /* Sigh. IE needs this width or it blows up. Firefox, Opera and Safari all behave correctly. */
}
/* The same line CSS ends here */
The width: 100% on the dl and the width: 80% in the dd section are not needed for any other browser but IE. Without a specific width set, IE will not clear the floats even with clear: both set, which is incorrect behavior according to http://www.w3.org/TR/CSS21/visuren.html#flow-control:
"When the [clear] property is set on floating elements, it results in a
modification of the rules for
positioning the float. An extra constraint (#10) is added:
- The top outer edge
of the float must be below the bottom outer
edge of all earlier left-floating boxes (in the case of 'clear:
left'), or all earlier right-floating boxes (in the case of 'clear:
right'), or both ('clear: both')."
The W3C spec says that floats with clears should be pushed downward. IE, without a specific width set, is putting some floats adjacent to other floats, which is clearly against the spec. By setting clear: both on the dt, which is the first element in every row, the dt and dd should be getting pushed to the next line by default, creating one dt/dd pair per row. This rule of CSS would make the problem of putting the dts and dds on the same line painfully simple, but IE needing the width means that the proper width would either have to be calculated or input by the user.
A bit old, but still relevant: http://agachi.name/weblog/archives/2005/06/09/clearing-floats-into-rows.htm and http://agachi.name/tests/clearing-floats-into-rows.htm
I've added http://www.lemonrage.com/nate/css/cssadapterexample/iefloatsample.html which when viewed in IE6 or IE7 shows what happens without a width set, but when viewed in any recent version of Firefox and Opera shows what should happen according to the W3C spec. =) It just has the width rules in the dl and dd sections removed.