freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-more-about-css-pseudo.../61fd6b7c83dbf54a08cf0498.md

1.7 KiB

id title challengeType dashedName
61fd6b7c83dbf54a08cf0498 Step 6 0 step-6

--description--

All'interno dell'elemento div, aggiungi tre elementi span. Dai a ciascuno di loro un attributo class con il valore year e aggiungi il seguente testo (in ordine): 2019, 2020 e 2021.

--hints--

L'elemento div dovrebbe avere tre elementi span.

assert(document.querySelector('div')?.children?.length === 3);

Ogni elemento span dovrebbe avere un attributo class con il valore year.

const spans = [...document.querySelector('div')?.children];
spans.forEach(span => assert(span?.classList?.contains('year')));

Il primo span dovrebbe avere il testo 2019.

assert(document.querySelector('div')?.children?.[0]?.textContent === '2019');

Il secondo span dovrebbe avere il testo 2020.

assert(document.querySelector('div')?.children?.[1]?.textContent === '2020');

Il terzo span dovrebbe avere il testo 2021.

assert(document.querySelector('div')?.children?.[2]?.textContent === '2021');

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Balance Sheet</title>
    <link rel="stylesheet" href="./styles.css">
  </head>
  <body>
    <main>
      <section>
        <h1>
          <span class="flex">
            <span>AcmeWidgetCorp</span>
            <span>Balance Sheet</span>
          </span>
        </h1>
--fcc-editable-region--
        <div id="years" aria-hidden="true">
        </div>
--fcc-editable-region--
      </section>
    </main>
  </body>
</html>