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

2.7 KiB
Raw Blame History

id title challengeType dashedName
5dfb6a35eacea3f48c6300b4 Step 24 0 step-24

--description--

Un elemento di didascalia della figura (figcaption) viene usato per aggiungere una didascalia per descrivere l'immagine contenuta nell'elemento figure. Ad esempio, <figcaption>A cute cat</figcaption> aggiunge la didascalia A cute cat.

Dopo l'immagine annidata nell'elemento figure, aggiungi un elemento figcaption impostato su:

Cats love lasagna.

--hints--

L'elemento figcaption dovrebbe avere un tag di apertura. I tag di apertura hanno la seguente sintassi: <nomeElemento>.

assert(document.querySelector('figcaption'));

L'elemento figcaption dovrebbe avere un tag di chiusura. I tag di chiusura hanno un carattere / subito dopo il carattere <.

assert(code.match(/<\/figcaption\>/));

L'elemento figcaption dovrebbe essere annidato nell'elemento figure.

assert(
  document.querySelector('figure > figcaption') &&
    document.querySelector('figure > figcaption')
);

Lelemento img con la lasagna dovrebbe essere annidato nellelemento figure.

assert(
  document.querySelector('figure > img') &&
    document.querySelector('figure > img').getAttribute('src').toLowerCase() ===
      'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg'
);

L'elemento figcaption annidato nell'elemento figure dovrebbe essere sotto l'elemento img. Sono nell'ordine sbagliato.

assert(
  document.querySelector('figcaption').previousElementSibling.nodeName === 'IMG'
);

Il testo dell'elemento figcaptiondovrebbe essere Cats love lasagna. Hai omesso il valore o hai un refuso.

assert(
  document.querySelector('figcaption').innerText.match(/Cats love lasagna.?$/i)
);

--seed--

--seed-contents--

<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>
      <section>
        <h2>Cat Lists</h2>
        <h3>Things cats love:</h3>
        <ul>
          <li>cat nip</li>
          <li>laser pointers</li>
          <li>lasagna</li>
        </ul>
--fcc-editable-region--
        <figure>
          <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
        </figure>
--fcc-editable-region--
      </section>
    </main>
  </body>
</html>