2021-12-03 14:20:34 -08:00
---
2022-02-18 10:15:16 -08:00
id: 61fd5a93fd62bb35968adeab
2021-12-03 14:20:34 -08:00
title: Step 1
challengeType: 0
dashedName: step-1
---
# --description--
2022-02-18 10:15:16 -08:00
Set up your HTML with the `DOCTYPE` , `html` , `head` , and `body` elements. Give your `head` element the appropriate `meta` elements for the `charset` and `viewport` , a `title` element with an appropriate title, and a `link` element for your stylesheet.
2021-12-03 14:20:34 -08:00
# --hints--
Your code should have a `<!DOCTYPE html>` declaration.
```js
assert(code.match(/<!DOCTYPE html> /i));
```
Your code should have an `html` element.
```js
2022-02-18 10:15:16 -08:00
assert.equal(document.querySelectorAll('html')?.length, 1);
2021-12-03 14:20:34 -08:00
```
Your code should have a `head` element within the `html` element.
```js
2022-02-18 10:15:16 -08:00
assert.equal(document.querySelectorAll('head')?.length, 1);
2021-12-03 14:20:34 -08:00
```
Your code should have a `body` element within the `html` element.
```js
2022-02-18 10:15:16 -08:00
assert.equal(document.querySelectorAll('body')?.length, 1);
2021-12-03 14:20:34 -08:00
```
Your `head` element should come before your `body` element.
```js
2022-02-18 10:15:16 -08:00
assert.equal(document.querySelector('body')?.previousElementSibling?.tagName, 'HEAD');
2021-12-03 14:20:34 -08:00
```
You should have two `meta` elements.
```js
const meta = document.querySelectorAll('meta');
2022-02-18 10:15:16 -08:00
assert.equal(meta?.length, 2);
2021-12-03 14:20:34 -08:00
```
One `meta` element should have a `name` set to `viewport` , and `content` set to `width=device-width, initial-scale=1.0` .
```js
const meta = [...document.querySelectorAll('meta')];
const target = meta?.find(m => m?.getAttribute('name') === 'viewport' & & m?.getAttribute('content') === 'width=device-width, initial-scale=1.0' & & !m?.getAttribute('charset'));
assert.exists(target);
```
The other `meta` element should have the `charset` attribute set to `UTF-8` .
```js
const meta = [...document.querySelectorAll('meta')];
const target = meta?.find(m => !m?.getAttribute('name') & & !m?.getAttribute('content') & & m?.getAttribute('charset')?.toLowerCase() === 'utf-8');
assert.exists(target);
```
Your code should have a `title` element.
```js
const title = document.querySelector('title');
assert.exists(title);
```
2022-02-18 10:15:16 -08:00
Your `title` should have some text.
2021-12-03 14:20:34 -08:00
```js
const title = document.querySelector('title');
2022-02-18 10:15:16 -08:00
assert.isAtLeast(title?.textContent?.length, 1);
2021-12-03 14:20:34 -08:00
```
Your code should have a `link` element.
```js
assert(/< link / . test ( code ) )
```
2022-02-18 10:15:16 -08:00
Your `link` element should be within your `head` element.
2021-12-03 14:20:34 -08:00
```js
2022-02-18 10:15:16 -08:00
assert(code.match(/< head > [\w\W\s]*< link [ \w\W\s]* \/? > [\w\W\s]*< \/head > /i))
2021-12-03 14:20:34 -08:00
```
2022-02-18 10:15:16 -08:00
Your `link` element should have a `rel` attribute with the value `stylesheet` .
2021-12-03 14:20:34 -08:00
```js
2022-02-18 10:15:16 -08:00
assert.match(code, /< link [ \s\S]*? rel = ('|"|`)stylesheet \1/)
2021-12-03 14:20:34 -08:00
```
2022-02-18 10:15:16 -08:00
Your `link` element should have a `type` attribute with the value `text/css` .
2021-12-03 14:20:34 -08:00
```js
2022-02-18 10:15:16 -08:00
assert.match(code, /< link [ \s\S]*? type = ('|"|`)text \/css \1/)
2021-12-03 14:20:34 -08:00
```
2022-02-18 10:15:16 -08:00
Your `link` element should have an `href` attribute with the value `styles.css` .
2021-12-03 14:20:34 -08:00
```js
2022-02-18 10:15:16 -08:00
assert.match(code, /< link [ \s\S]*? href = ('|"|`)( \.\/)?styles \.css \1/)
2021-12-03 14:20:34 -08:00
```
# --seed--
## --seed-contents--
```html
--fcc-editable-region--
--fcc-editable-region--
```
```css
```