2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: bad87fee1348bd9bec908846
|
2021-03-05 02:55:32 +00:00
|
|
|
|
title: 创建一个 Bootstrap Row
|
2018-10-10 22:03:03 +00:00
|
|
|
|
challengeType: 0
|
2020-09-07 08:17:39 +00:00
|
|
|
|
forumTopicId: 16813
|
2021-01-13 02:31:00 +00:00
|
|
|
|
dashedName: create-a-bootstrap-row
|
2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --description--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
这次为内联元素创建一个 Bootstrap 栅格系统的 Row(行)。
|
2020-09-07 08:17:39 +00:00
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
在 `h3` 标签下方创建一个 class 属性为 `row` 的 `div` 元素。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --hints--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
`h3` 元素下应该增加一个 `div` 元素。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
```js
|
|
|
|
|
assert(
|
|
|
|
|
$('div').length > 1 &&
|
|
|
|
|
$('div.row h3.text-primary').length == 0 &&
|
|
|
|
|
$('div.row + h3.text-primary').length == 0 &&
|
|
|
|
|
$('h3.text-primary + div.row').length > 0
|
|
|
|
|
);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
`div` 元素的 class 属性应为 `row`。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
```js
|
|
|
|
|
assert($('div').hasClass('row'));
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
`row div` 应该内嵌于 `container-fluid div`。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
```js
|
|
|
|
|
assert($('div.container-fluid div.row').length > 0);
|
|
|
|
|
```
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2021-03-05 02:55:32 +00:00
|
|
|
|
确保所有 `div` 元素都有一个闭合标签。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
```js
|
|
|
|
|
assert(
|
|
|
|
|
code.match(/<\/div>/g) &&
|
|
|
|
|
code.match(/<div/g) &&
|
|
|
|
|
code.match(/<\/div>/g).length === code.match(/<div/g).length
|
|
|
|
|
);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --solutions--
|
|
|
|
|
|
2021-01-13 02:31:00 +00:00
|
|
|
|
```html
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
|
|
|
<div class="row"></div>
|
|
|
|
|
</div>
|
|
|
|
|
```
|