如何在引导程序中对齐元素

时间:2015-06-09 16:55:25

标签: css twitter-bootstrap font-awesome

PLS。看看我的代码@ http://www.bootply.com/VcVDblSFK7 - 我希望在同一行中使用键符号和输入控件的跨度(后跟error-msg的span)。但是我做了太多的编辑,并没有找到解决方法。

<div class="row">
  <div class="col-md-8">
    <div class="col-md-3">
      <div class="input-group">
        <span class="fa fa-key fa-fw input-group-addon"></span>
        <input id="oldpswd" name="oldpswd" placeholder="Altes Passwort" type="password" class="form-control">
      </div>
    </div>
    <span id="oldpswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <div class="col-md-3">
      <div class="input-group">
        <span class="fa fa-key fa-fw input-group-addon"></span>
        <input id="newpswd" name="newpswd" placeholder="Neues Passwort" type="password" class="form-control">
      </div>
    </div>
    <span id="newpswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <div class="col-md-3">
      <div class="input-group">
        <span class="fa fa-key fa-fw input-group-addon"></span>
        <input id="reppswd" name="reppswd" placeholder="Passwort wiederholen" type="password" class="form-control">
      </div>
    </div>
    <span id="reppswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>

1 个答案:

答案 0 :(得分:4)

你正在寻找这样的东西吗? http://www.bootply.com/RBjyGORKLe

    <div class="row">
  <div class="col-md-8">
    <div class="form-inline col-md-3">
        <div class="form-group">        
            <div class="input-group">
                <div class="input-group-addon"><span class="fa fa-key fa-fw"></span></div>
                    <input id="oldpswd" name="oldpswd" placeholder="Altes Passwort" type="password" class="form-control">   
            </div>
        </div>      
    </div>
    <span id="oldpswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <div class="form-inline col-md-3">
        <div class="form-group">        
            <div class="input-group">
                <div class="input-group-addon"><span class="fa fa-key fa-fw"></span></div>
                    <input id="oldpswd" name="newpswd" placeholder="Neues Passwort" type="password" class="form-control">   
            </div>
        </div>      
    </div>
    <span id="newpswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <div class="form-inline col-md-3">
        <div class="form-group">        
            <div class="input-group">
                <div class="input-group-addon"><span class="fa fa-key fa-fw"></span></div>
                    <input id="reppswd" name="reppswd" placeholder="Passwort wiederholen" type="password" class="form-control">   
            </div>
        </div>      
    </div>
    <span id="reppswd_errmsg" class="bg-danger col-md-3">xxxx</span>
  </div>
</div>