2022-04-22 16:40:12 +00:00
---
id: 6140c7e645d8e905819f1dd4
title: Step 1
challengeType: 0
dashedName: step-1
---
# --description--
2022-08-16 07:09:24 +00:00
Inizia con il testo HTML standard. Aggiungi la dichiarazione `DOCTYPE` e gli elementi `html` (specificando che la pagina è in inglese), `head` e `body` .
2022-04-22 16:40:12 +00:00
2022-06-15 14:11:40 +00:00
Aggiungi l'elemento `meta` per il `charset` corretto, l'elemento `title` e un elemento `link` per il file `./styles.css` .
2022-04-22 16:40:12 +00:00
2022-06-15 14:11:40 +00:00
Dai all'elemento `title` il testo `Ferris Wheel` .
2022-04-22 16:40:12 +00:00
# --hints--
2022-06-15 14:11:40 +00:00
Il codice dovrebbe contenere il riferimento `DOCTYPE` .
2022-04-22 16:40:12 +00:00
```js
assert(code.match(/< !DOCTYPE/gi));
```
Dovresti includere uno spazio dopo il riferimento `DOCTYPE` .
```js
assert(code.match(/< !DOCTYPE\s+/gi));
```
2022-06-15 14:11:40 +00:00
Dovresti definire il tipo di documento come `html` .
2022-04-22 16:40:12 +00:00
```js
assert(code.match(/< !DOCTYPE\s+html/gi));
```
2022-06-15 14:11:40 +00:00
Dovresti chiudere la dichiarazione `DOCTYPE` con un carattere `>` .
2022-04-22 16:40:12 +00:00
```js
assert(code.match(/<!DOCTYPE \s+html \s*> /gi));
```
2022-07-08 17:58:33 +00:00
L'elemento `html` dovrebbe avere una tag di apertura con un attributo `lang` di `en` .
2022-04-22 16:40:12 +00:00
```js
2022-07-08 17:58:33 +00:00
assert(code.match(/< html \s+ lang \s*= \s*('|") en \1\s* > /gi));
2022-04-22 16:40:12 +00:00
```
2022-06-15 14:11:40 +00:00
L'elemento `html` dovrebbe avere un tag di chiusura.
2022-04-22 16:40:12 +00:00
```js
assert(code.match(/< \/html \s* > /));
```
2022-06-15 14:11:40 +00:00
La dichiarazione `DOCTYPE` dovrebbe essere all'inizio dell'HTML.
2022-04-22 16:40:12 +00:00
```js
assert(__helpers.removeHtmlComments(code).match(/^\s*<!DOCTYPE \s+html \s*> /i));
```
Dovresti avere un tag `head` di apertura.
```js
assert(code.match(/< head \s* > /i));
```
Dovresti avere un tag `head` di chiusura.
```js
assert(code.match(/< \/head \s* > /i));
```
Dovresti avere un tag `body` di apertura.
```js
assert(code.match(/< body \s* > /i));
```
Dovresti avere un tag `body` di chiusura.
```js
assert(code.match(/< \/body \s* > /i));
```
Gli elementi `head` e `body` dovrebbero essere fratelli.
```js
assert(document.querySelector('head')?.nextElementSibling?.localName === 'body');
```
L'elemento `head` dovrebbe essere dentro l'elemento `html` .
```js
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head'));
```
L'elemento `body` dovrebbe essere dentro l''elemento `html` .
```js
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body'));
```
2022-06-15 14:11:40 +00:00
Il codice dovrebbe avere un elemento `meta` .
2022-04-22 16:40:12 +00:00
```js
const meta = document.querySelector('meta');
assert.exists(meta);
```
2022-06-15 14:11:40 +00:00
L'elemento `meta` dovrebbe avere un attributo `charset` con il valore `UTF-8` .
2022-04-22 16:40:12 +00:00
```js
2022-06-15 14:11:40 +00:00
assert.match(code, /< meta [ \s\S]+? charset = ('|"|`)UTF-8 \1/i)
2022-04-22 16:40:12 +00:00
```
2022-06-15 14:11:40 +00:00
Il codice dovrebbe avere un elemento `title` .
2022-04-22 16:40:12 +00:00
```js
const title = document.querySelector('title');
assert.exists(title);
```
2022-06-15 14:11:40 +00:00
Il progetto dovrebbe avere il titolo `Ferris Wheel` .
2022-04-22 16:40:12 +00:00
```js
const title = document.querySelector('title');
assert.equal(title?.text?.trim()?.toLowerCase(), 'ferris wheel')
```
2022-06-15 14:11:40 +00:00
Fai attenzione all'uso delle maiuscole/minuscole e all'ortografia nel titolo.
2022-04-22 16:40:12 +00:00
```js
const title = document.querySelector('title');
assert.equal(title?.text?.trim(), 'Ferris Wheel');
```
2022-06-15 14:11:40 +00:00
Il codice dovrebbe avere un elemento `link` .
2022-04-22 16:40:12 +00:00
```js
assert.match(code, /< link / )
```
2022-07-08 17:58:33 +00:00
Dovresti avere un elemento `link` auto-concludente.
2022-04-22 16:40:12 +00:00
```js
2022-07-08 17:58:33 +00:00
assert(document.querySelectorAll('link').length === 1);
2022-04-22 16:40:12 +00:00
```
2022-06-15 14:11:40 +00:00
L'elemento `link` dovrebbe essere all'interno dell'elemento `head` .
2022-04-22 16:40:12 +00:00
```js
2022-07-08 17:58:33 +00:00
assert.exists(document.querySelector('head > link'));
2022-04-22 16:40:12 +00:00
```
2022-06-15 14:11:40 +00:00
L'elemento `link` dovrebbe avere un attributo `rel` con il valore `stylesheet` .
2022-04-22 16:40:12 +00:00
```js
2022-07-08 17:58:33 +00:00
const link_element = document.querySelector('link');
const rel = link_element.getAttribute("rel");
assert.equal(rel, "stylesheet");
2022-04-22 16:40:12 +00:00
```
2022-06-15 14:11:40 +00:00
L'elemento `link` dovrebbe avere un attributo `href` con il valore `styles.css` .
2022-04-22 16:40:12 +00:00
```js
2022-07-08 17:58:33 +00:00
const link = document.querySelector('link');
assert.equal(link.dataset.href, "styles.css");
2022-04-22 16:40:12 +00:00
```
# --seed--
## --seed-contents--
```html
--fcc-editable-region--
--fcc-editable-region--
```
```css
```