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