2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: bad87fee1348bd9bec908846
|
|
|
|
|
challengeType: 0
|
2020-09-07 16:17:39 +08:00
|
|
|
|
forumTopicId: 16813
|
2020-10-01 17:54:21 +02:00
|
|
|
|
title: 创建一个 Bootstrap Row
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-09-07 16:17:39 +08:00
|
|
|
|
<section id='description'>
|
|
|
|
|
这次让我们为内联元素创建一个 Bootstrap 栅格系统的 Row(行)。
|
|
|
|
|
在 <code>h3</code> 标签下方创建一个 class 属性为 <code>row</code> 的 <code>div</code> 元素。
|
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Instructions
|
2020-09-07 16:17:39 +08:00
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: <code>h3</code> 元素下增加一个 <code>div</code> 元素。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: 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));
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: <code>div</code> 元素的 class 属性应为 <code>row</code>。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert($("div").hasClass("row"));
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: <code>row div</code> 应该内嵌于 <code>container-fluid div</code>。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert($("div.container-fluid div.row").length > 0);
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: 确保所有 <code>div</code> 元素都有一个闭合标签。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(code.match(/<\/div>/g) && code.match(/<div/g) && code.match(/<\/div>/g).length === code.match(/<div/g).length);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
2020-09-07 16:17:39 +08:00
|
|
|
|
```html
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
|
|
|
<div class="row"></div>
|
|
|
|
|
</div>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
2020-09-07 16:17:39 +08:00
|
|
|
|
</section>
|