freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-elemen...

1.1 KiB

id title challengeType videoUrl forumTopicId
bad87fee1348bd9aedf0887a 用 h2 元素代表副标题 0 https://scrimba.com/p/pVMPUv/cE8Gqf3 18196

--description--

在接下来的几节课里,我们将会由浅入深地制作一个 CatPhotoApp。

这节课将会引入h2元素。

这些元素用来告诉浏览器,网站的结构是什么样子。h1元素通常被用作主标题,h2元素通常被用作副标题,还有h3h4h5h6元素,它们分别用作不同级别的标题。

--instructions--

h1元素下面创建一个h2元素,元素内容为:CatPhotoApp

--hints--

创建一个h2元素。

assert($('h2').length > 0);

h2元素应该有结束标记。

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

h2元素的内容应为:CatPhotoApp

assert.isTrue(/cat(\s)?photo(\s)?app/gi.test($('h2').text()));

h1元素的内容应为:Hello World

assert.isTrue(/hello(\s)+world/gi.test($('h1').text()));

--solutions--