gpt4 book ai didi

forms - Bootstrap : form-horizontal not styling as expected

转载 作者:行者123 更新时间:2023-12-04 02:24:13 25 4
gpt4 key购买 nike

我正在使用 twitter Bootstrap ,并希望有一个水平形式,如这里的演示所示:http://twitter.github.com/bootstrap/base-css.html#forms

但是,我得到了一种垂直表单,我猜想带有标签而不是控件,我找不到垂直表单样式不起作用的原因。

这是 html 代码(使用 symfony2 框架生成:

<form class="form-horizontal" method="POST" action="/yourownpoet/web/app_dev.php/register/">
<label class=" required" for="fos_user_registration_form_email" placeholder="Email">Email:</label>
<input id="fos_user_registration_form_email" class="text-style" type="email" placeholder="Email" required="required" name="fos_user_registration_form[email]">
<div placeholder="Password" id="fos_user_registration_form_plainPassword"> <div>
<label class=" required" for="fos_user_registration_form_plainPassword_Enter Password: ">Enter password: </label>
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Enter Password: ]" id="fos_user_registration_form_plainPassword_Enter Password: " class="text-style">
</div>
<div>
<label class=" required" for="fos_user_registration_form_plainPassword_Verify Password: ">Verify password: </label>
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Verify Password: ]" id="fos_user_registration_form_plainPassword_Verify Password: " class="text-style">
</div>
etc...
</form>

有什么我做错了吗?

最佳答案

您需要申请.control-label分类到您的标签并将您的输入分隔在 .controls 中让您的表单样式正确应用的容器。试试这个:

<form class="form-horizontal" method="POST" action="/yourownpoet/web/app_dev.php/register/">
<div class="control-group">
<label class="control-label required" for="fos_user_registration_form_email" placeholder="Email">Email:</label>
<div class="controls">
<input id="fos_user_registration_form_email" class="text-style" type="email" placeholder="Email" required="required" name="fos_user_registration_form[email]">
<div placeholder="Password" id="fos_user_registration_form_plainPassword"></div>
</div>
</div>

<div class="control-group">
<label class="control-label required" for="fos_user_registration_form_plainPassword_Enter Password: ">Enter password: </label>
<div class="controls">
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Enter Password: ]" id="fos_user_registration_form_plainPassword_Enter Password: " class="text-style">
</div>
</div>
<div class="control-group">
<label class="control-label required" for="fos_user_registration_form_plainPassword_Verify Password: ">Verify password: </label>
<div class="controls">
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Verify Password: ]" id="fos_user_registration_form_plainPassword_Verify Password: " class="text-style">
</div>
</div>
</form>

关于forms - Bootstrap : form-horizontal not styling as expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11448245/

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