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

1.9 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
bad87fee1348bd9aedf0887a Headline with the h2 Element 0 标题与h2元素

Description

在接下来的几节课中我们将逐个构建一个HTML5猫照片网络应用程序。您将在此步骤中添加的h2元素将向网页添加第二级标题。此元素告诉浏览器您的网站结构。 h1元素通常用于主标题,而h2元素通常用于子标题。还有h3 h4 h5h6元素表示不同级别的副标题。

Instructions

添加h2标签上面写着“CatPhotoApp”创建第二个HTML element你的“Hello World”的h1元素。

Tests

tests:
  - text: 创建一个<code>h2</code>元素。
    testString: 'assert(($("h2").length > 0), "Create an <code>h2</code> element.");'
  - text: 确保您的<code>h2</code>元素具有结束标记。
    testString: 'assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(/<h2>/g).length, "Make sure your <code>h2</code> element has a closing tag.");'
  - text: 您的<code>h2</code>元素应该包含文本“CatPhotoApp”。
    testString: 'assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()), "Your <code>h2</code> element should have the text "CatPhotoApp".");'
  - text: 你的<code>h1</code>元素应该有“Hello World”文本。
    testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), "Your <code>h1</code> element should have the text "Hello World".");'

Challenge Seed

<h1>Hello World</h1>

Solution

// solution required