--- id: bad87fee1347bd9aedf08845 title: 用 Bootstrap 來取代我們之前的自定義樣式 challengeType: 0 forumTopicId: 17565 dashedName: ditch-custom-css-for-bootstrap --- # --description-- 現在可以清理一下之前代碼,用 Bootstrap 的內置樣式來替換之前定義的樣式,這樣 Cat Photo App 看起來更簡潔些。 別擔心——以後會有大把時間來自定義 CSS 樣式的。 刪除 `style` 元素裏的 `.red-text`,`p`,和 `.smaller-image` CSS 定義,使 `style` 元素只留下 `h2` 和 `thick-green-border`。 刪除包含死鏈接的 `p` 元素。 然後將 `h2` 的 `red-text` class 替換爲 Bootstrap 的 `text-primary` class。 最後,從第一個 `img` 元素中刪除 `smaller-image` class,並將其替換爲 `img-responsive` class。 # --hints-- `h2` 元素不應該有 `red-text` class。 ```js assert(!$('h2').hasClass('red-text')); ``` `h2` 元素應有 `text-primary` class。 ```js assert($('h2').hasClass('text-primary')); ``` 段落元素(p)不應該再使用 `Monospace` 字體。 ```js assert( !$('p') .css('font-family') .match(/monospace/i) ); ``` 移除第一張圖片的 `smaller-image` class 屬性。 ```js assert(!$('img').hasClass('smaller-image')); ``` 給第一張圖片添加 `img-responsive` class 屬性。 ```js assert($('.img-responsive').length > 1); ``` # --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

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