--- id: bad87fee1348cd8acef08812 title: 创建一个 Bootstrap 块级元素按钮 challengeType: 0 forumTopicId: 16810 dashedName: create-a-block-element-bootstrap-button --- # --description-- 一般情况下,`btn` 和 `btn-default` 两个 classes 修饰的 `button` 元素宽度与它包含的文本相同, 举个例子: ```html ``` 这个按钮的宽度应该和文本 `Submit` 的宽度相同。 通过为按钮添加 class 属性 `btn-block` 使其成为块级元素,按钮会伸展并填满页面的整个水平空间,后续的元素会流到这个块级元素的下方,即 "另起一行"。 ```html ``` 这个按钮会 100% 占满所有的可用宽度。 注意,这些按钮仍然需要 `btn` 这个 class。 给刚创建的 Bootstrap 按钮添加 Bootstrap 的 `btn-block` class。 # --hints-- 按钮仍然应该有 `btn` 和 `btn-default` class。 ```js assert($('button').hasClass('btn') && $('button').hasClass('btn-default')); ``` 按钮应该有 `btn-block` class。 ```js assert($('button').hasClass('btn-block')); ``` 所有 `button` 元素都应该有闭合标签。 ```js assert( code.match(/<\/button>/g) && code.match(/

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. Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

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