强制标签与其标签的输入内联 [英] Forcing label to flow inline with input that they label
本文介绍了强制标签与其标签的输入内联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要标签与他们标记的输入字段保持在同一行。我想让这些元素流动,就像他们通常情况下,当窗口调整大小,我只是希望标签贴在他们标记的输入的左边。我该怎么做?任何想法?
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"/>
解答:Josiah Ruddell的答案是在正确的路径上,使用span而不是div行为。谢谢!
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>
推荐答案
div with nowrap。
put them both inside a div
with nowrap.
<div style="white-space:nowrap">
<label for="id1">label1:</label>
<input type="text" id="id1"/>
</div>
这篇关于强制标签与其标签的输入内联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文