2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: bad87fee1348bd9aec908846
|
|
|
|
|
title: Create a Bootstrap Headline
|
|
|
|
|
challengeType: 0
|
2020-09-07 16:17:39 +08:00
|
|
|
|
forumTopicId: 16812
|
|
|
|
|
localeTitle: 创建一个 Bootstrap 标题
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-09-07 16:17:39 +08:00
|
|
|
|
<section id='description'>
|
|
|
|
|
现在,让我们运用 HTML,CSS 和 Bootstrap 从零开始做点东西。
|
|
|
|
|
我们将会搭建一个 jQuery playground,以便在后续的 jQuery 课程中使用它。
|
|
|
|
|
首先,创建一个包含 <code>jQuery Playground</code> 文本内容的 <code>h3</code> 元素。
|
|
|
|
|
通过给你的 <code>h3</code> 元素设置 Bootstrap 的 class 属性 <code>text-primary</code> 来为其上色,然后添加 Bootstrap 的 class 属性 <code>text-center</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> 元素。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert($("h3") && $("h3").length > 0);
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: 确保你的 <code>h3</code> 元素有一个闭合标签。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(code.match(/<\/h3>/g) && code.match(/<h3/g) && code.match(/<\/h3>/g).length === code.match(/<h3/g).length);
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: 为了确保成功上色,<code>h3</code> 元素应该具有 <code>text-primary</code> class。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert($("h3").hasClass("text-primary"));
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: 为了确保文本居中显示,你的 <code>h3</code> 元素应该具有 <code>text-center</code> class。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert($("h3").hasClass("text-center"));
|
2020-09-07 16:17:39 +08:00
|
|
|
|
- text: <code>h3</code> 元素文本为 <code>jQuery Playground</code>。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.isTrue((/jquery(\s)+playground/gi).test($("h3").text()));
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
2020-09-07 16:17:39 +08:00
|
|
|
|
```html
|
|
|
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
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>
|