---
id: bad87fee1348bd9aedf0887a
title: Headline with the h2 Element
challengeType: 0
videoUrl: ''
localeTitle: 标题与h2元素
---
## Description
在接下来的几节课中,我们将逐个构建一个HTML5猫照片网络应用程序。您将在此步骤中添加的h2
元素将向网页添加第二级标题。此元素告诉浏览器您的网站结构。 h1
元素通常用于主标题,而h2
元素通常用于子标题。还有h3
, h4
, h5
和h6
元素表示不同级别的副标题。
## Instructions
添加h2
标签,上面写着“CatPhotoApp”创建第二个HTML element
你的“Hello World”的h1
元素。
## Tests
```yml
tests:
- text: 创建一个h2
元素。
testString: 'assert(($("h2").length > 0), "Create an h2
element.");'
- text: 确保您的h2
元素具有结束标记。
testString: 'assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(//g).length, "Make sure your h2
element has a closing tag.");'
- text: 您的h2
元素应该包含文本“CatPhotoApp”。
testString: 'assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()), "Your h2
element should have the text "CatPhotoApp".");'
- text: 你的h1
元素应该有“Hello World”文本。
testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), "Your h1
element should have the text "Hello World".");'
```
## Challenge Seed
## Solution
```js
// solution required
```