【问题标题】:How to make a custom-width centered container in Twitter Bootstrap?如何在 Twitter Bootstrap 中制作自定义宽度居中的容器?
【发布时间】:2013-04-16 08:28:04
【问题描述】:

过去一天我一直在处理一个非常奇怪的问题,到目前为止我不明白我哪里出错了。

首先,我要做的是使用 Bootstrap 创建一个单列固定容器布局,宽度为33em,并使用自动边距水平居中。

我要实现的第二件事是将span 类与这个新的33em 布局一起使用。

我该怎么做?我已经实现了第一个,但是自动边距不起作用(它们因页面而异)。

使用 LESS 和 Bootstrap 2.3。

【问题讨论】:

    标签: css twitter-bootstrap less margin


    【解决方案1】:

    如果你想让你的 div 居中创建一个类;

    wrap {
        position: absolute;
        display: block;
        width: 33em;
        height: 330px;
        margin-top: -165px;
        margin-left: -16.5em;
        left: 50%;
        top: 50%;
    }
    

    <div class="container wrap"></div> 将居中。

    【讨论】:

      猜你喜欢
      • 2013-05-09
      • 2014-07-13
      • 1970-01-01
      • 1970-01-01
      • 2014-01-29
      • 2021-11-01
      • 1970-01-01
      • 2013-10-20
      • 1970-01-01
      相关资源
      最近更新 更多