html代码
<div class="container">
<div class="row" id="login">
<div class="col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4 col-xs-8 col-xs-offset-2">
<form class="form-horizontal">
<div class="form-group form-inline">
<label for="username"><i class="fa fa-user"></i>用户名:</label>
<input type="text" id="username" placeholder="请输入用户名">
</div>
<div class="form-group form-inline">
<label for="password"><i class="fa fa-lock"></i>用户名:</label>
<input type="password" id="password" placeholder="请输入密码">
</div>
<button type="submit" id="login_submit">登录</button>
</form>
</div>
</div>
</div>
css代码
label { width:30%;}
input { width:68%; border: none;}
#login_submit{ width:60%;}
把两个子元素同时设置为左浮动就可以 但是元素无法居中