freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-grid-by-building-.../614387cbefeeba5f3654a291.md

4.0 KiB

id title challengeType dashedName
614387cbefeeba5f3654a291 Step 7 0 step-7

--description--

Dopo l'elemento header, crea un elemento div con l'attributo class impostato su author.

All'interno di questo div, crea un elemento p con un attributo class di author-name e dagli il testo By freeCodeCamp. Racchiudi freeCodeCamp in un elemento a con l'attributo href impostato su https://freecodecamp.org e l'attributo target impostato su _blank.

Sotto questo, aggiungi un secondo elemento p con la classe publish-date e il testo March 7, 2019.

--hints--

Dovresti creare un elemento div.

assert.exists(document.querySelector('div'));

L'elemento div dovrebbe trovarsi dopo l'elemento header.

assert(document.querySelector('div')?.previousElementSibling?.localName === 'header');

L'elemento div dovrebbe avere l'attributo class impostato su author.

assert(document.querySelector('div')?.className === 'author');

Dovresti creare due nuovi elementi p.

assert(document.querySelectorAll('p')?.length === 3);

I nuovi elementi p dovrebbero trovarsi all'interno dell'elemento div.

assert.exists(document.querySelector('div')?.querySelectorAll('p')?.length === 2);

Il primo nuovo elemento p dovrebbe avere un attributo class con il valore author-name.

assert(document.querySelector('div')?.querySelector('p')?.className === 'author-name');

Il primo nuovo elemento p dovrebbe avere il testo By freeCodeCamp.

assert(document.querySelector('div')?.querySelector('p')?.innerText === 'By freeCodeCamp');

Il secondo nuovo elemento p dovrebbe avere un attributo class con il valore publish-date.

assert(document.querySelector('div')?.querySelectorAll('p')?.[1]?.className === 'publish-date');

Il secondo nuovo elemento p dovrebbe avere il testo March 7, 2019.

assert(document.querySelector('div')?.querySelectorAll('p')?.[1]?.innerText === 'March 7, 2019');

Dovresti creare un elemento a.

assert.exists(document.querySelector('a'));

L'elemento a dovrebbe essere annidato nel primo nuovo elemento p.

assert(document.querySelector('div')?.querySelector('p')?.firstElementChild?.localName === 'a');

L'elemento a dovrebbe avere un attributo href con il valore https://freecodecamp.org.

assert(document.querySelector('div')?.querySelector('p')?.firstElementChild?.getAttribute('href') === 'https://freecodecamp.org');

L'elemento a dovrebbe avere un attributo target con il valore _blank.

assert(document.querySelector('div')?.querySelector('p')?.firstElementChild?.getAttribute('target') === '_blank');

L'elemento a dovrebbe racchiudere il testo freeCodeCamp.

assert(document.querySelector('div')?.querySelector('p')?.firstElementChild?.textContent === 'freeCodeCamp');

--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>Magazine</title>
    <link
      href="https://fonts.googleapis.com/css?family=Anton%7CBaskervville%7CRaleway&display=swap"
      rel="stylesheet"
    />
    <link
      rel="stylesheet"
      href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
    />
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <main>
      <section class="heading">
        <header class="hero">
          <img
            src="https://cdn.freecodecamp.org/platform/universal/fcc_meta_1920X1080-indigo.png"
            alt="freecodecamp logo"
            loading="lazy"
            class="hero-img"
            width="400"
          />
          <h1 class="hero-title">OUR NEW CURRICULUM</h1>
          <p class="hero-subtitle">
            Our efforts to restructure our curriculum with a more project-based
            focus
          </p>
        </header>
--fcc-editable-region--

      </section>
    </main>
--fcc-editable-region--
  </body>
</html>