> Hello,
>
[quoted text clipped - 34 lines]
> I'm hoping for a solution completely in CSS, I hope you guys
> understand my problem and can help me.
This is one case where it's legitimate to use a table, assuming that was
the concern behind your wanting to do this completely in CSS. You have a
bona fide two-dimensional array where the rows are different items and
the columns are, for each one, a label and an input field.
Scripsit k3pp0:
> I want all the <label>s to have the same width, so the labels and
> inputs line up nicely.
There's not much reason not to use a table. A table may cause problems
to some speech-based browsers that cannot then associate labels with
input fields, but using <label> markup mostly handles this. Note,
however, that your markup needs a fix:
<label for="username">Username:</label>
<input type="text" name="username" />
The for="..." attribute needs to refer to an element by its id="..."
attribute, so you need to add it:
<input type="text" name="username" id="username" />
You _can_, however, use CSS instead of a table. The simplest way is
probably to make the <label> elements floated; for an example, see
http://www.cs.tut.fi/~jkorpela/forms/tables.html#css
> For exmaple: label { width: 200px; }.
Oh no. What would that cause when the user changes font size to, say,
60px?
Use the em, Luke.
And using a table is even more flexible, since you don't need to make
any guess on the width. Of course it would be nice to do the same in
CSS, but for that, we would need (surprise!) the tabular presentation
properties, such as display: table and all that, which isn't supported
by IE even in IE 7.
> Now I want all the <input>s to fit the rest of the width of the
> browser window. So if you resize the window, the input fields fill out
> the space between the "right border of the <label>" and the "right
> border of the browser window" automatically. You could say: <label> +
> <input> = 100% of the window's width.
Using table markup, you would set the table width to 100% (in HTML or in
CSS) and the width of the <input> elements to 100% (in CSS).
Using just CSS, I'm afraid there's no way at present.

Signature
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/