gpt4 book ai didi

html - 如何在 Twitter Bootstrap 中将帮助文本添加到输入上方而不是下方

转载 作者:太空狗 更新时间:2023-10-29 14:02:08 25 4
gpt4 key购买 nike

在使用 Twitter Bootstrap 创建表单时,如何将帮助文本添加到输入的上方而不是下方。当我使用“help-block”类在输入上方插入语句时,标签和输入不再对齐。有解决办法吗?

最佳答案

bootstrap 在它的 css 类中已经有了这种资源。看看samples .

您的代码必须在 form-group 上类,像这样:

<div class="form-group">
<label for="info-email" class="col-xs-2 control-label">e-mail</label>
<div class="col-xs-10">
<input type="text" class="form-control" id="info-email" placeholder="Your e-mail">
<small class="text-muted">We'll never share your email with anyone else.</small>
</div>
</div>

sample of below

而且,如果您需要将帮助文本放在输入上方,只需更改 <small>...</small> 的位置即可到输入的上面:

<div class="form-group">
<label for="info-email" class="col-xs-2 control-label">e-mail</label>
<div class="col-xs-10">
<small class="text-muted">We'll never share your email with anyone else.</small>
<input type="text" class="form-control" id="info-email" placeholder="Your e-mail">
</div>
</div>

sample of above

关于html - 如何在 Twitter Bootstrap 中将帮助文本添加到输入上方而不是下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11840709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com