Label and input field in one line
I have the following html:
<label>blah</label>
<input type=text ... />
I want the label to be on one line and below the input field.
It is currently on the same line, do I need to use clear?
Do it with CSS:
label {clear: both; }
You can put a class or css style that will change the display to block:
<label style="display:block">blah</label>
<input type=text ... />
<label>blah</label>
<br />
<input type=text ... />
Use a line break.
<label for="fldAge">Age:</label>
<p>
<input type="text" name="Age" id="fldAge" />
</p>
It also forces the browser to display the text associated with the input with the focus rectangle and allows the user to focus the field by clicking anywhere in the associated text, not just by manipulating the input field.
You can do throw ( <br />
) in between, or place each in its own div.
The easiest way is to add <br>
after </label>
.
Alternatively you can use div tags or a table with two lines.