I am trying to solve the problem presented in this original post. Basically, I would like to create a form where a labels and related inputs are on the same line. Labels have a fixed width and inputs extend for the remaining form width. Each label + input couple has its own line.
<form>
<label for="name">Name:</label>
<input id="name"/>
<label for="email">Email:</label>
<input id="email"/>
</form>
I've read the solution proposed in this post but I doesn't convince me much. I think it's not very semantic, because it introduces a formLine
class. I may be super-fussy, but I think that HTML code should only contain semantic stuff (in this case label
and input
) and layout should be left to stylesheet only.
Does anybody have a clue to style the snippet above without adding not-semantic code? I think the key should be to tell input
to occupy the remaining line space, to avoid to use something like <br/>
after each input.