html - 图例形式中的水平形式

标签 html css twitter-bootstrap

如何向图例形式添加水平形式?当我尝试这样做时,水平形式看起来并不像它应该的那样:http://i.imgur.com/tJAT5k4.png

这是我的代码:

<form>
 <fieldset>
 <legend>Legend Text</legend>
 <form class="form-horizontal">
   <div class="control-group">
   <label class="control-label" for="inputEmail">Email</label>
   <div class="controls">
   <input type="text" id="inputEmail" placeholder="Email">
   </div>
   </div>
   <div class="control-group">
   <label class="control-label" for="inputPassword">Password</label>
   <div class="controls">
   <input type="password" id="inputPassword" placeholder="Password">
   </div>
   </div>
   <div class="control-group">
   <div class="controls">
   <label class="checkbox">
   <input type="checkbox"> Remember me
   </label>
   <button type="submit" class="btn">Sign in</button>
   </div>
   </div>
 </form>
 </fieldset>
</form>

所有的 CSS 都是 bootstrap 默认的 CSS。

最佳答案

去掉外面的<form>标签。

<fieldset>
 <legend>Legend Text</legend>
 <form class="form-horizontal">
   <div class="control-group">
   <label class="control-label" for="inputEmail">Email</label>
   <div class="controls">
   <input type="text" id="inputEmail" placeholder="Email">
   </div>
   </div>
   <div class="control-group">
   <label class="control-label" for="inputPassword">Password</label>
   <div class="controls">
   <input type="password" id="inputPassword" placeholder="Password">
   </div>
   </div>
   <div class="control-group">
   <div class="controls">
   <label class="checkbox">
   <input type="checkbox"> Remember me
   </label>
   <button type="submit" class="btn">Sign in</button>
   </div>
   </div>
 </form>
</fieldset>

关于html - 图例形式中的水平形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15606455/

相关文章:

javascript - 将特定深度的innerHTML提取到DOM树结构中

php - 在 dompdf 中设置页脚

html - Bootstrap 按钮是重叠文本

angularjs - 仅当浏览器本身不支持日期输入时,如何使用 Angular UI 的 Bootstrap DatePicker?

css - Bootstrap 面板标题和主体比面板短

html - 如何为 HTML 5 <picture> 设置空图像?

jquery - 如何垂直居中一行以上的文本(仅适用于 chrome)?

html - 如何使文本溢出对 HTML 中的输入元素可见?

html - 具有多个 ID 或类的元素的适当 CSS 语法

javascript - 重新加载页面时如何保持选项卡处于事件状态?