--- 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
```