[thelist] CSS Form layout w/out span|div

RUST Randal RRust at COVANSYS.com
Thu Feb 20 11:54:01 CST 2003


Ben Nolan said:

> Above is an article on laying out forms using css - but
> without using structural markup in the form - using html4
> form extensions: label legend and fieldset.
>
> View source - you may be pleasantly surprised. :)

This isn't going to work without putting the <label> in front of the
corresponding <input>. I see that you're validating to HTML 4
Transitional, but if you were doing XHTML, like I do in the examples
that I just posted, then all form elements must be inside of a fieldset.
Otherwise it won't validate. This may also be the case with HTML 4, but
I didn't check.

It seems to me that I saw a similar solution some time ago on CSS-D, but
that broke down as well.

The key is that you have to have some type of structural element that
works like a table row. Hence the <div> solutions that you see (and I
just posted). If you don't do this, and you run into a situation where
your <label> text wraps, it will seriously make a mess of things.

----------
Randal Rust
Covansys Corp.
Columbus, OH



More information about the thelist mailing list