[thelist] Forms and Presentation (CSS)

David Dorward evolt at david.us-lot.org
Wed Jun 18 13:12:13 CDT 2003


On Wed, Jun 18, 2003 at 05:30:11 +0100, Chris Marsh wrote:
> Dear all
> 
> How do people display forms as follows using CSS and XHTML?
> 
> _______________________________________________
> |Username:    [................]              |
> |---------------------------------------------|
> |Password:    [................]              |
> |---------------------------------------------|
> |             [ Login ]                       |
> |---------------------------------------------|
> 
> I want the tabular style layout, but presume that tables are not
> applicable for the layout of a form. I'm using labels, but the "label"
> tag seems not to have a "width" attribute in CSS. Should I nest the
> labels within a "span" tag, applying a value to the "width" attribute of
> this tag? Any advice would be very much appreciated.

Nothing has an attribute in CSS, CSS deals with properties. The width
property doesn't apply to elements that display inline, such as
<label> or <span> do by default.

Something along the lines of:

label {
      display: block;
      width: 50%;
      float: left;
}

should get you started.

-- 
David Dorward                                     http://david.us-lot.org/
         Redesign in progress: http://stone.thecoreworlds.net/
  Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/2003/5/30/microsoft-announces-ie-is-dead


More information about the thelist mailing list