php - 使用 Bootstrap 居中内容

标签 php javascript twitter-bootstrap alignment

所以,我有这个代码

<div class="featurette">
            <img class="featurette-image pull-right" src="img/BreadBakersGuildLogo.jpg">
            <div class="text-center">
                <h2>Justin</h2>
                <p class="lead">
                    Stuff about Justin
                </p>
            </div>
            <div class="pull-left">
                <ul>
                    <li>Stuff about contacts</li>
                    <li>Stuff</li>
                </ul>
            </div>
        </div>

不幸的是,text-center 下的文本未居中。好像有点偏左。我还做了this fiddle 来证明我的意思。

谢谢!

最佳答案

问题是:

您正在使用.container对于 <body>其中有 width: 940pxp有一个display: block并且它是引用 940px 进行渲染的。

一种解决方案是使用 .container{ width: 100%} ,因为您稍后也可能会遇到此问题。

关于php - 使用 Bootstrap 居中内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16720303/

相关文章:

php - 处理 URL 参数 - 以斜杠分隔的名称值对

php - 使用 filter 方法过滤 Laravel Eloquent 集合

javascript - 使用 Phonegap 3.3.0 for ios 访问文件

javascript - Woocommerce:未触发交付方法更改事件处理程序

javascript - Angular 2将html附加到正文

jquery - DataTable 不会使用 Bootstrap 启动

jquery - 关闭 bootstrap-select/select2 的自动对焦

php - 为什么 css 在 codeigniter 上不起作用?

php - 如何在我的网站上创建用户生成的页面?

c# - 在 C# 中返回一个 JavaScript 类型的日期