--- id: bad87fee1348bd8acde08812 title: 用 Bootstrap 居中文本 challengeType: 0 forumTopicId: 16771 dashedName: center-text-with-bootstrap --- # --description-- 可以使用 Bootstrap 将顶部的元素居中来美化页面。 只需要将 `h2` 元素的 class 属性设置为 `text-center` 就可以实现。 记住:可以为一个元素添加多个 classes ,class 间通过空格分隔,就像这样: ```html

your text

``` # --hints-- 应使用 `text-center` class 将 `h2` 元素居中。 ```js assert($('h2').hasClass('text-center')); ``` `h2` 元素应具有 `red-text` class。 ```js assert($('h2').hasClass('red-text')); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back. Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
``` # --solutions-- ```html

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back. Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
```