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

2.6 KiB

id title challengeType dashedName
612e6afc009b450a437940a1 Step 1 0 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.

assert(code.match(/<!DOCTYPE/gi));

Dovresti includere uno spazio dopo il riferimento DOCTYPE.

assert(code.match(/<!DOCTYPE\s+/gi));

Dovresti definire il tipo di documento come html.

assert(code.match(/<!DOCTYPE\s+html/gi));

Dovresti chiudere la dichiarazione DOCTYPE con un carattere >.

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.

assert(code.match(/<html\s+lang\s*=\s*('|")en\1\s*>/gi));

L'elemento html dovrebbe avere un tag di chiusura.

assert(code.match(/<\/html\s*>/));

La dichiarazione DOCTYPE dovrebbe essere all'inizio del tuo HTML.

assert(__helpers.removeHtmlComments(code).match(/^\s*<!DOCTYPE\s+html\s*>/i));

Dovresti avere un tag di apertura head.

assert(code.match(/<head\s*>/i));

Dovresti avere un tag di chiusura head.

assert(code.match(/<\/head\s*>/i));

Dovresti avere un tag di apertura body.

assert(code.match(/<body\s*>/i));

Dovresti avere un tag di chiusura body.

assert(code.match(/<\/body\s*>/i));

Gli elementi head e body dovrebbero essere fratelli.

assert(document.querySelector('head')?.nextElementSibling?.localName === 'body');

L'elemento head dovrebbe trovarsi all'interno dell'elemento html.

assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head'));

L'elemento body dovrebbe trovarsi all'interno dell'elemento html.

assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body'));

Il codice dovrebbe avere un elemento title.

const title = document.querySelector('title');
assert.exists(title);

Il progetto dovrebbe avere un title del valore di Piano.

const title = document.querySelector('title');
assert.equal(title?.text?.trim()?.toLowerCase(), 'piano')

Fai attenzione all'uso delle maiuscole/minuscole e all'ortografia nel titolo.

const title = document.querySelector('title');
assert.equal(title?.text?.trim(), 'Piano');

--seed--

--seed-contents--

--fcc-editable-region--

--fcc-editable-region--