I need the label to stay on the same line as the input field they are labeling. I want these elements to flow like they normally would when the window resizes, i just want the label to stick to the left of the input they are labeling. How would I do that? Any ideas?
<label for="id1">label1:</label>
<input type="text" id="id1"/>
<label for="id2">label2:</label>
<input type="text" id="id2"/>
ANSWERED: Josiah Ruddell's answer was on the right path, using a span instead of div gave me the correct behavior. Thanks!
<span style="white-space:nowrap">
<label for="id1">label1:</label>
<input type="text" id="id1"/>
</span>
<span style="white-space:nowrap">
<label for="id2">label2:</label>
<input type="text" id="id2"/>
</span>
put them both inside a
div
with nowrap.http://jsfiddle.net/jwB2Y/123/
The following CSS class force the label text to flow inline and get clipped if its length is more than max-length of the label.
HTML:
Wrap your inputs within the label tag
Put the
input
in the label, and ditch thefor
attributeBut of course, what if you want to style the text? Just use a
span
.If you want they to be paragraph, then use it.
Both
<label>
and<input>
are paragraph and flow content so you can insert as paragraph elements and as block elements.Why don't You just use: