freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-responsive-web-design.../612e6afc009b450a437940a1.md

134 lines
2.6 KiB
Markdown

---
id: 612e6afc009b450a437940a1
title: Step 1
challengeType: 0
dashedName: step-1
---
# --description--
Inizia a scrivere la struttura HTML di base. Aggiungi la dichiarazione `DOCTYPE` e gli elementi `html`, `head`, `body` e `title`.
Imposta la lingua della pagina sull'inglese. Aggiungi il testo `Piano` nell'elemento `title`.
# --hints--
Il codice dovrebbe contenere il riferimento `DOCTYPE`.
```js
assert(code.match(/<!DOCTYPE/gi));
```
Dovresti includere uno spazio dopo il riferimento `DOCTYPE`.
```js
assert(code.match(/<!DOCTYPE\s+/gi));
```
Dovresti definire il tipo di documento come `html`.
```js
assert(code.match(/<!DOCTYPE\s+html/gi));
```
Dovresti chiudere la dichiarazione `DOCTYPE` con un carattere `>`.
```js
assert(code.match(/<!DOCTYPE\s+html\s*>/gi));
```
L'elemento `html` dovrebbe avere una tag di apertura con un attributo `lang` del valore di `en`.
```js
assert(code.match(/<html\s+lang\s*=\s*('|")en\1\s*>/gi));
```
L'elemento `html` dovrebbe avere un tag di chiusura.
```js
assert(code.match(/<\/html\s*>/));
```
La dichiarazione `DOCTYPE` dovrebbe essere all'inizio del tuo HTML.
```js
assert(__helpers.removeHtmlComments(code).match(/^\s*<!DOCTYPE\s+html\s*>/i));
```
Dovresti avere un tag di apertura `head`.
```js
assert(code.match(/<head\s*>/i));
```
Dovresti avere un tag di chiusura `head`.
```js
assert(code.match(/<\/head\s*>/i));
```
Dovresti avere un tag di apertura `body`.
```js
assert(code.match(/<body\s*>/i));
```
Dovresti avere un tag di chiusura `body`.
```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 trovarsi all'interno dell'elemento `html`.
```js
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head'));
```
L'elemento `body` dovrebbe trovarsi all'interno dell'elemento `html`.
```js
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body'));
```
Il codice dovrebbe avere un elemento `title`.
```js
const title = document.querySelector('title');
assert.exists(title);
```
Il progetto dovrebbe avere un title del valore di `Piano`.
```js
const title = document.querySelector('title');
assert.equal(title?.text?.trim()?.toLowerCase(), 'piano')
```
Fai attenzione all'uso delle maiuscole/minuscole e all'ortografia nel titolo.
```js
const title = document.querySelector('title');
assert.equal(title?.text?.trim(), 'Piano');
```
# --seed--
## --seed-contents--
```html
--fcc-editable-region--
--fcc-editable-region--
```
```css
```