freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-animation-by-buil.../6140c7e645d8e905819f1dd4.md

3.7 KiB

id title challengeType dashedName
6140c7e645d8e905819f1dd4 Step 1 0 step-1

--description--

Inizia con il testo HTML standard. Aggiungi la dichiarazione DOCTYPE e gli elementi html (specificando che la pagina è in inglese), head e body.

Aggiungi l'elemento meta per il charset corretto, l'elemento title e un elemento link per il file ./styles.css.

Dai all'elemento title il testo Ferris Wheel.

--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 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 dell'HTML.

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

Dovresti avere un tag head di apertura.

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

Dovresti avere un tag head di chiusura.

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

Dovresti avere un tag body di apertura.

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

Dovresti avere un tag body di chiusura.

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 essere dentro l'elemento html.

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

L'elemento body dovrebbe essere dentro l''elemento html.

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

Il codice dovrebbe avere un elemento meta.

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

L'elemento meta dovrebbe avere un attributo charset con il valore UTF-8.

assert.match(code, /<meta[\s\S]+?charset=('|"|`)UTF-8\1/i)

Il codice dovrebbe avere un elemento title.

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

Il progetto dovrebbe avere il titolo Ferris Wheel.

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

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

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

Il codice dovrebbe avere un elemento link.

assert.match(code, /<link/)

Dovresti avere un elemento link auto-concludente.

assert(document.querySelectorAll('link').length === 1);

L'elemento link dovrebbe essere all'interno dell'elemento head.

assert.exists(document.querySelector('head > link'));

L'elemento link dovrebbe avere un attributo rel con il valore stylesheet.

const link_element = document.querySelector('link');
const rel = link_element.getAttribute("rel");
assert.equal(rel, "stylesheet");

L'elemento link dovrebbe avere un attributo href con il valore styles.css.

const link = document.querySelector('link');
assert.equal(link.dataset.href, "styles.css");

--seed--

--seed-contents--

--fcc-editable-region--

--fcc-editable-region--