Bootstrap标签和输入字段不显示水平

时间:2013-09-30 19:49:06

标签: css3 twitter-bootstrap twitter-bootstrap-3

我已经从bootstrap中复制并粘贴了示例代码。我已经包含了bootstrap CSS和JS文件& jQuery库。 Base CSS - Bootstrap

由于某些原因,标签和输入字段显示为内联。有人可以看看我做错了吗?

<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>

1 个答案:

答案 0 :(得分:0)

尝试使用.form-group而不是.control-group class。

请记住在表单标记之后使用.col - - *类设置容器。

实施例

 <form class="" role="form" method="POST" action="{form_action}" onsubmit="return ValidateForm()" enctype="multipart/form-data">

     <div class="col-sm-6 col-md-6">      
        <div class="form-group">
           <label class="control-label label-fw">Vendida?&ensp;</label>
           {chk_sold}
        </div><!-- form group -->

        <div class="form-group">
           <label for="txt_title" class="control-label label-fw">T&iacute;tulo&ensp;</label>
           <input name="txt_title" type="text" class="form-control input" id="txt_title" value="{txt_title}" placeholder="titulo del producto">
        </div><!-- form group -->

        <div class="form-group">
            <label for="txt_title" class="control-label label-fw">Categor&iacute;a&ensp;</label>
           {cbo_type}
        </div><!-- form group -->

        <div class="">
           <label for="txt_aution_date_d" class="control-label label-fw">Fecha&ensp;</label>
           <input name="txt_auction_date_d" type="text" class="form-control" id="txt_auction_date_d" value="{txt_auction_date_d}" placeholder="MM/DD/AAAA">
        </div><!-- form group -->                       

     </div><!-- col-sm-6 col-md-6 -->
  </form>

如果有效,请告诉我。