2.3 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5d822fd413a79914d39e98cc | Step 4 | 0 | step-4 |
--description--
Dentro head
, annida un elemento meta
con un charset
di UTF-8
, un elemento title
con il titolo City Skyline
e un elemento link
che linka il tuo file styles.css
.
--hints--
Dovresti creare un elemento meta
dentro l'elemento head
.
assert.exists(document.querySelector('head > meta'));
Dovresti assegnare al tag meta
un attributo charset
con il valore UTF-8
.
assert.equal(document.querySelector('head > meta')?.getAttribute('charset')?.toLowerCase(), 'utf-8');
Il codice dovrebbe avere un elemento title
.
const title = document.querySelector('title');
assert.exists(title);
L'elemento title
dovrebbe essere all'interno dell'elemento head
.
assert.exists(document.querySelector('head > title'));
Il progetto dovrebbe avere il titolo City Skyline
.
const title = document.querySelector('title');
assert.equal(title.text.toLowerCase(), 'city skyline')
Fai attenzione all'uso delle maiuscole/minuscole e all'ortografia nel titolo.
const title = document.querySelector('title');
assert.equal(title.text, 'City Skyline');
Il codice dovrebbe avere un elemento link
.
assert.match(code, /<link/)
Non dovresti cambiare i tag head
esistenti. Assicurati di non aver eliminato il tag di chiusura.
const heads = document.querySelectorAll('head');
assert.equal(heads?.length, 1);
Dovresti avere un elemento link
auto-concludente.
assert(document.querySelectorAll('link').length === 1);
L'elemento link
dovrebbe trovarsi 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--
<!DOCTYPE html>
<html lang="en">
--fcc-editable-region--
<head>
</head>
--fcc-editable-region--
<body>
</body>
</html>