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

182 lines
3.7 KiB
Markdown
Raw Normal View History

---
id: 6140c7e645d8e905819f1dd4
title: Step 1
challengeType: 0
dashedName: 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`.
```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` 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 dell'HTML.
```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'));
```
Il codice dovrebbe avere un elemento `meta`.
```js
const meta = document.querySelector('meta');
assert.exists(meta);
```
L'elemento `meta` dovrebbe avere un attributo `charset` con il valore `UTF-8`.
```js
assert.match(code, /<meta[\s\S]+?charset=('|"|`)UTF-8\1/i)
```
Il codice dovrebbe avere un elemento `title`.
```js
const title = document.querySelector('title');
assert.exists(title);
```
Il progetto dovrebbe avere il titolo `Ferris Wheel`.
```js
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.
```js
const title = document.querySelector('title');
assert.equal(title?.text?.trim(), 'Ferris Wheel');
```
Il codice dovrebbe avere un elemento `link`.
```js
assert.match(code, /<link/)
```
Dovresti avere un elemento `link` auto-concludente.
```js
assert(document.querySelectorAll('link').length === 1);
```
L'elemento `link` dovrebbe essere all'interno dell'elemento `head`.
```js
assert.exists(document.querySelector('head > link'));
```
L'elemento `link` dovrebbe avere un attributo `rel` con il valore `stylesheet`.
```js
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`.
```js
const link = document.querySelector('link');
assert.equal(link.dataset.href, "styles.css");
```
# --seed--
## --seed-contents--
```html
--fcc-editable-region--
--fcc-editable-region--
```
```css
```