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

99 lines
2.7 KiB
Markdown

---
id: 5f07fb1579dc934717801375
title: Step 32
challengeType: 0
dashedName: step-32
---
# --description--
È ora di aggiungere una nuova sezione. Aggiungi un terzo elemento `section` sotto il secondo elemento `section`.
# --hints--
L'elemento `section` dovrebbe avere un tag di apertura. I tag di apertura hanno questa sintassi: `<nomeElemento>`.
```js
assert(document.querySelectorAll('section').length >= 3);
```
Dovresti aggiungere un solo tag di apertura `section`. Rimuovi quelli di troppo.
```js
assert(document.querySelectorAll('section').length === 3);
```
L'elemento `section` dovrebbe avere un tag di chiusura. I tag di chiusura hanno un carattere `/` subito dopo il carattere `<`.
```js
assert(code.match(/<\/section>/g).length >= 3);
```
Dovresti aggiungere un solo tag di chiusura `section`. Rimuovi quelli di troppo.
```js
assert(code.match(/<\/section>/g).length === 3);
```
Tutti gli elementi `section` dovrebbero essere compresi tra i tag di apertura e chiusura dell'elemento `main`.
```js
const childrenOfMain = [...document.querySelector('main').children];
const sectionElemsFound = childrenOfMain.filter((child) => {
return child.nodeName === 'SECTION';
});
assert(sectionElemsFound.length === 3);
```
L'ultimo elemento `section` non dovrebbe avere contenuti. Rimuovi qualsiasi elemento HTML o testo all'interno dell'elemento `section`.
```js
assert($('main > section')[2].children.length === 0);
```
# --seed--
## --seed-contents--
```html
<html>
<body>
<h1>CatPhotoApp</h1>
<main>
<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>
<h2>Cat Lists</h2>
<h3>Things cats love:</h3>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<figure>
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
<figcaption>Cats <em>love</em> lasagna.</figcaption>
</figure>
<h3>Top 3 things cats hate:</h3>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<figure>
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg" alt="Five cats looking around a field.">
<figcaption>Cats <strong>hate</strong> other cats.</figcaption>
</figure>
</section>
--fcc-editable-region--
</main>
</body>
</html>
```