2

在我的网页上,我有一个居中的徽标/潜在客户以及徽标/潜在客户下方的两个 div。我希望根据徽标/引导使 div 看起来居中。

我试图通过使用 Twitter Bootstrap 的跨度使 div 居中,但 div 仍然没有真正居中。

    <div class="row-fluid marketing">
        <div class="span3"></div>
        <div class="span3 text-glow-hover-with-delay">
            <h2><i class="icon-beaker"> </i> Genuinely Tested</h2>
            <p>
                Guru has undergone an enormous amount of testing
                <br />
                via <a href="http://junit.org" rel="tooltip" data-toggle="tooltip" data-placement="bottom" title=""
                data-original-title="Visit their website!">JUnit</a>; the programmer-oriented testing framework.
            </p>
        </div>
        <div class="span4 text-glow-hover-with-delay">
            <h2><i class="icon-book"> </i> Full Documentation</h2>
            <p>
                We provide full-source/full-documentation for our users.
            </p>
        </div>
    </div>

如果您需要更多信息,可以查看网站: http: //guru.jire.org

4

2 回答 2

3

您可以通过将span4更改为span3(奇等规则)然后将 div 设置为 align-center来使它们真正居中。完整来源如下。

    <div class="row-fluid marketing">
        <div class="span3"></div>
        <div class="span3 text-glow-hover-with-delay" align="center">
            <h2><i class="icon-beaker"> </i> Genuinely Tested</h2>
            <p>
                Guru has undergone an enormous amount of testing
                <br />
                via <a href="http://junit.org" rel="tooltip" data-toggle="tooltip" data-placement="bottom" title=""
                data-original-title="Visit their website!">JUnit</a>; the programmer-oriented testing framework.
            </p>
        </div>
        <div class="span3 text-glow-hover-with-delay" align="center">
            <h2><i class="icon-book"> </i> Full Documentation</h2>
            <p>
                We provide full-source/full-documentation for our users.
            </p>
        </div>
    </div>
于 2013-07-26T21:47:48.930 回答
2

以这种方式看待它可能会有所帮助: 居中的例子

div 上的边框可帮助您查看正在发生的事情,对角线显示真正的中心在哪里。

如果您为 div 提供一致的宽度,它们将看起来更加对称和居中,这可能就是您获得所需外观所需的全部内容。

于 2013-07-26T21:53:21.873 回答