freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-html-by-building-a-ca.../5dfa3589eacea3f48c6300ae.md

77 lines
1.9 KiB
Markdown

---
id: 5dfa3589eacea3f48c6300ae
title: Step 18
challengeType: 0
dashedName: step-18
---
# --description--
All'interno del secondo elemento `section`, aggiungi un nuovo elemento `h2` con il testo `Cat Lists`.
# --hints--
L'elemento `section` dovrebbe avere un tag di apertura. I tag di apertura hanno questa sintassi: `<nomeElemento>`.
```js
assert(
document.querySelectorAll('section').length === 2 &&
code.match(/<\/section>/g).length === 2
);
```
L'elemento `h2` dovrebbe avere un tag di apertura. I tag di apertura hanno questa sintassi: `<nomeElemento>`.
```js
assert(document.querySelectorAll('h2').length === 2);
```
L'elemento `h2` dovrebbe avere un tag di chiusura. I tag di chiusura hanno un carattere `/` subito dopo il carattere `<`.
```js
assert(code.match(/<\/h2\>/g).length === 2);
```
Il secondo elemento `h2` dovrebbe essere proprio sopra il tag di chiusura del secondo elemento `section`. Non è nella posizione corretta.
```js
const secondSection = document.querySelectorAll('section')[1];
assert(secondSection.lastElementChild.nodeName === 'H2');
```
Il secondo elemento `h2` dovrebbe avere il testo `Cat Lists`. Hai omesso il testo o hai un refuso.
```js
assert(
document
.querySelectorAll('main > section')[1]
.lastElementChild.innerText.toLowerCase() === 'cat lists'
);
```
# --seed--
## --seed-contents--
```html
<html>
<body>
<main>
<h1>CatPhotoApp</h1>
<section>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
<p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
<a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
</section>
--fcc-editable-region--
<section>
</section>
--fcc-editable-region--
</main>
</body>
</html>
```