为什么我的按钮没有在我的表格中心对齐?

时间:2013-12-11 00:28:48

标签: html twitter-bootstrap

enter image description here我使用twitter bootstrap库设计页面,遗憾的是,我的注册按钮与其他元素不对齐。我有什么想法吗?

<!DOCTYPE html>
<html lang="en">
  <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Login form">
<meta name="me" content="Med Ayman">
<title>Bootbusiness | Give unique title of the page here</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap responsive -->
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- Font awesome - iconic font with IE7 support --> 
<link href="css/font-awesome.css" rel="stylesheet">
<link href="css/font-awesome-ie7.css" rel="stylesheet">
<!-- Bootbusiness theme -->
<link href="css/nehalem.css" rel="stylesheet">
<!--responsive images-->
<link href="css/responsive.css" rel="stylesheet">

<img  class="myimg" src="img/logo.png" alt="my logo"/>

<form class="well span4" align="center">
    <input type="text" class="span3" placeholder="Username"/><br/>
    <input type="password" class="span3" placeholder="Password"/><br/>
    <button class="btn btn-primary span3">Sign in</button>
</form>

2 个答案:

答案 0 :(得分:0)

按钮实际上是对齐中心,表单输入不是。检查任何其他样式,或将类似的东西应用于输入:

display: block; margin: 0px auto;

答案 1 :(得分:0)

这样你就可以实现

<img  class="myimg" src="img/logo.png" alt="my logo"/>
<div class="col-sm-6 col-sm-offset-3 well">
 <form class="">
   <div class="form-group">
        <label class="sr-only" for="form-username">Username</label>
        <input type="text" class="form-control" placeholder="Username"/>
   </div>
   <div class="form-group">
        <label class="sr-only" for="form-password">Password</label>
        <input type="password" class="form-control" placeholder="Password"/>
   </div>
   <button type="submit" class="btn btn-primary">Sign in</button>
 </form>
</div>