--- id: bad87fee1348bd9acde08712 title: 使用 Bootstrap Fluid 容器实现响应式设计 challengeType: 0 forumTopicId: 18362 dashedName: use-responsive-design-with-bootstrap-fluid-containers --- # --description-- 之前,在 freeCodeCamp 的 HTML5 和 CSS 章节中我们构建了一个 Cat Photo App。 我们在此基础上继续学习。 这次我们将会使用最受欢迎的响应式 CSS 框架 Bootstrap 来美化它。 Bootstrap 会根据屏幕大小来动态调整 HTML 元素的大小————因此称为 Responsive Design(响应式设计)。 通过响应式设计,我们将无需额外设计一个手机版的网页, 因为它在任何尺寸的屏幕上看起来都很棒。 任何 Web 应用,都可以通过添加如下代码到 HTML 顶部来引入 Bootstrap 。 ```html ``` 不过在这里,已经预先为此页面添加了上述代码。 注意使用 `>` 或者 `/>` 两种方式闭合 `link` 标签都是可行的。 首先,我们应该将所有 HTML( `link` 标签和 `style` 元素除外)嵌套在带有 `container-fluid` class 的 `div` 元素里面。 # --hints-- `div` 元素应该有 `container-fluid` class。 ```js assert($('div').hasClass('container-fluid')); ``` `div` 元素应该有结束标签。 ```js assert( code.match(/<\/div>/g) && code.match(/
/g).length === code.match(/
= 8 && !$('.container-fluid').has("style").length && !$('.container-fluid').has("link").length); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back.

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.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

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