--- id: bad87fee1348bd9aedb08845 title: 響應式風格的單選按鈕 challengeType: 0 forumTopicId: 18270 required: - link: >- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css raw: true dashedName: responsively-style-radio-buttons --- # --description-- Bootstrap 的 `col-xs-*` class 也可以用在 `form` 元素上! 這樣就可以在不關心屏幕大小的情況下,將的單選按鈕均勻的平鋪在頁面上。 將所有單選按鈕放入 `
` 元素中。 再用 `
` 元素包裹每一個單選按鈕。 **注意:** 提醒一句,單選按鈕是 type 爲 `radio` 的 `input` 元素。 # --hints-- 所有的單選按鈕應該放置於具有 `row` class 的 `div` 元素中。 ```js assert($('div.row:has(input[type="radio"])').length > 0); ``` 每一個單選按鈕應該嵌套於具有 class 屬性爲 `col-xs-6` 的 `div` 元素之中。 ```js assert($('div.col-xs-6:has(input[type="radio"])').length > 1); ``` 確保所有 `div` 元素都有閉合標籤。 ```js assert( code.match(/<\/div>/g) && code.match(/
/g).length === code.match(/

CatPhotoApp

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

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

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:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

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