2018-09-30 22:01:58 +00:00
---
id: bad87fee1348bd9aedf0887a
title: Headline with the h2 Element
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gqf3'
2019-07-31 18:32:23 +00:00
forumTopicId: 18196
2021-01-13 02:31:00 +00:00
dashedName: headline-with-the-h2-element
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
Over the next few lessons, we'll build an HTML5 cat photo web app piece-by-piece.
2020-11-27 18:02:05 +00:00
The `h2` element you will be adding in this step will add a level two heading to the web page.
This element tells the browser about the structure of your website. `h1` elements are often used for main headings, while `h2` elements are generally used for subheadings. There are also `h3` , `h4` , `h5` and `h6` elements to indicate different levels of subheadings.
# --instructions--
Add an `h2` tag that says "CatPhotoApp" to create a second HTML element below your "Hello World" `h1` element.
# --hints--
You should create an `h2` element.
```js
assert($('h2').length > 0);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
Your `h2` element should have a closing tag.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert(
code.match(/< \/h2 > /g) &&
code.match(/< \/h2 > /g).length === code.match(/< h2 > /g).length
);
```
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Your `h2` element should have the text `CatPhotoApp` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.isTrue(/cat(\s)?photo(\s)?app/gi.test($('h2').text()));
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
Your `h1` element should have the text `Hello World` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.isTrue(/hello(\s)+world/gi.test($('h1').text()));
```
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Your `h1` element should be before your `h2` element.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert(code.match(/< h1 > \s*?.*?\s*?< \/h1 > \s*< h2 > \s*?.*?\s*?< \/h2 > /gi));
```
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2020-07-08 20:13:02 +00:00
2019-01-25 16:19:27 +00:00
```html
< h1 > Hello World< / h1 >
2018-09-30 22:01:58 +00:00
```
2019-01-25 16:19:27 +00:00
2020-11-27 18:02:05 +00:00
# --solutions--
2019-01-25 16:19:27 +00:00
2020-11-27 18:02:05 +00:00
```html
< h1 > Hello World< / h1 >
< h2 > CatPhotoApp< / h2 >
```