freeCodeCamp/curriculum/challenges/chinese/03-front-end-development-li.../bootstrap/create-a-bootstrap-headline.md

1.4 KiB
Raw Blame History

id title challengeType forumTopicId dashedName
bad87fee1348bd9aec908846 创建一个 Bootstrap 标题 0 16812 create-a-bootstrap-headline

--description--

现在,来运用 HTML、CSS 和 Bootstrap 从头开始做点东西。

接下来将会搭建一个 jQuery playground以便在后续的 jQuery 课程中使用它。

首先,创建一个包含 jQuery Playground 文本内容的 h3 元素。

通过给 h3 元素设置 Bootstrap 的 text-primary class 属性来为其上色,然后添加 Bootstrap 的 text-center class 属性使其文本居中显示。

--hints--

为页面添加一个 h3 元素。

assert($('h3') && $('h3').length > 0);

确保 h3 元素有一个闭合标签。

assert(
  code.match(/<\/h3>/g) &&
    code.match(/<h3/g) &&
    code.match(/<\/h3>/g).length === code.match(/<h3/g).length
);

为了确保成功上色,h3 元素应该具有 text-primary class。

assert($('h3').hasClass('text-primary'));

为了确保文本居中显示,h3 元素应该具有 text-center class。

assert($('h3').hasClass('text-center'));

h3 元素文本内容为 jQuery Playground

assert.isTrue(/jquery(\s)+playground/gi.test($('h3').text()));

--seed--

--seed-contents--


--solutions--

<h3 class="text-primary text-center">jQuery Playground</h3>