【问题标题】:How to align a twitter bootstrap form of class well in the center of a page?如何在页面中心很好地对齐 twitter bootstrap 类的形式?
【发布时间】:2013-12-11 00:50:39
【问题描述】:

我正在尝试将我的课程形式很好地放在屏幕中间,有人可以告诉我如何修改此代码吗?

<body>

<div class="container">
    <div class="container">
        <img  class="myimg" src="img/logo.png" alt="my logo"/>
    </div>
    <div class="container">
        <form class="well span4">
            <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>
    </div>
</div>

【问题讨论】:

    标签: html css forms twitter-bootstrap


    【解决方案1】:

    尝试使用

    <div class="container text-center">
    

    在您拥有的第二个 .container 上(.well 的父级)。

    【讨论】:

      【解决方案2】:

      应该这样做。只需将您的表格偏移 4。这是有效的,因为 3 个列的宽度相同

      <div class="container">
      <div class="container">
          <img  class="myimg" src="img/logo.png" alt="my logo"/>
      </div>
      <div class="container">
          <form class="well offset4 span4">
              <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>
      </div>
      

      【讨论】:

      • 但是如果我想保持响应能力,那不是毁了这件事吗?
      猜你喜欢
      • 2013-08-07
      • 2019-10-14
      • 1970-01-01
      • 2012-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-08
      • 2018-06-23
      相关资源
      最近更新 更多