您如何使用 Twitter Bootstrap 获得居中的内容? [英] How do you get centered content using Twitter Bootstrap?

查看:27
本文介绍了您如何使用 Twitter Bootstrap 获得居中的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试遵循一个非常基本的示例.使用 起始页和网格系统,我希望如下:

<div class="span12"><h1>Bootstrap 启动模板</h1><p>示例文本.</p>

...会产生居中文本.

然而,它仍然出现在最左边.我做错了什么?

解决方案

This is for Text Centering(问题是关于什么)

对于其他类型的内容,请参阅Flavien 的回答.

更新:Bootstrap 2.3.0+ 答案

最初的答案是针对早期版本的引导程序.从 bootstrap 2.3.0 开始,你可以简单地给 div 类.text-center.

<小时>

原始答案(2.3.0 之前)

您需要使用 text-align: center 定义两个类之一,rowspan12.请参阅 http://jsfiddle.net/xKSUH/http://jsfiddle.net/xKSUH/1/

I'm trying to follow a very basic example. Using the starter page and the grid system, I was hoping the following:

<div class="row">
  <div class="span12">
    <h1>Bootstrap starter template</h1>
    <p>Example text.</p>
  </div>
</div>

...would produce centered text.

However, it still appears on the far left. What am I doing wrong?

解决方案

This is for Text Centering (which is what the question was about)

For other types of content, see Flavien's answer.

Update: Bootstrap 2.3.0+ Answer

The original answer was for an early version of bootstrap. As of bootstrap 2.3.0, you can simply give the div the class .text-center.


Original Answer (pre 2.3.0)

You need to define one of the two classes, row or span12 with a text-align: center. See http://jsfiddle.net/xKSUH/ or http://jsfiddle.net/xKSUH/1/

这篇关于您如何使用 Twitter Bootstrap 获得居中的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆