Twitter bootstrap 如何在Bootstrap 2表单中排列标签和只读字段
在bootstrap2中,建议使用什么方法在表单中排列标签和只读文本字段。以下代码示例创建未对齐的字段:Twitter bootstrap 如何在Bootstrap 2表单中排列标签和只读字段,twitter-bootstrap,twitter-bootstrap-2,Twitter Bootstrap,Twitter Bootstrap 2,在bootstrap2中,建议使用什么方法在表单中排列标签和只读文本字段。以下代码示例创建未对齐的字段: <form class="form-horizontal"> <fieldset> <legend>Sample</legend> <div class="control-group"> <label class="control-label">Re
<form class="form-horizontal">
<fieldset>
<legend>Sample</legend>
<div class="control-group">
<label class="control-label">Readonly Field</label>
<div class="controls">
Lorem Ipsum and then some
</div>
</div>
</fieldset>
</form>
样品
只读字段
先是同侧叶,然后是一些
请注意,我可以用自定义CSS自己解决这个问题。这不是问题所在。这似乎很愚蠢,因为它不是内置的,所以我觉得我一定忽略了一些东西。您可以使用不可编辑的输入
<span class="input-xlarge uneditable-input">Lorem Ipsum and then some</span>
有一个黑客。您可以与类“checkbox”一起使用 就你而言: <div class="controls"> <label class="checkbox"> Lorem Ipsum and then some </label> </div> 先是同侧叶,然后是一些
从bootstrap 4.0开始,
.form control static
类已被.form control plaintext
类取代。刚刚意识到我的问题是错误的,你回答得很好,所以我将其标记为正确答案。但是,如果我只想在标签的右侧显示文字,你知道该怎么办吗。在某些情况下,使用只读文本框并不合适。就像我最初的例子一样。当然,但是如果我不想要一个看起来像输入的字段,而只是一个与标签对齐的纯文本,那该怎么办?回到普通的CSS?不幸的是,引导并不能解决所有问题。IMO Twitter本身并不是表单之王,它们使用的表单很少。检查并发布,希望对某人有所帮助。“checkbox”的垂直对齐方式正确(我们正在寻找顶部填充的内容:5px,是吗?),但在我的页面上不起作用,因为它也添加了不需要的20px填充。我想我可能会选择自定义类。
<div class="controls">
<label class="checkbox">
Lorem Ipsum and then some
</label>
</div>