Back to Freecodecamp

Step 35

curriculum/challenges/english/blocks/learn-html-by-building-a-cat-photo-app/5f07fb1579dc934717801375.md

latest2.7 KB
Original Source

--description--

It is time to add a new section. Add a third section element below the second section element.

--hints--

Your section element should have an opening tag. Opening tags have this syntax: <elementName>.

js
assert(document.querySelectorAll('section').length >= 3);

You should only add one opening section tag. Please remove any extras.

js
assert(document.querySelectorAll('section').length === 3);

Your section element should have a closing tag. Closing tags have a / just after the < character.

js
assert(code.match(/<\/section>/g).length >= 3);

You should only add one closing section tag. Please remove any extras.

js
assert(code.match(/<\/section>/g).length === 3);

All of the section elements should be between the opening and closing tags of the main element.

js
const childrenOfMain = [...document.querySelector('main').children];
const sectionElemsFound = childrenOfMain.filter((child) => {
  return child.nodeName === 'SECTION';
});
assert(sectionElemsFound.length === 3);

The last section element should have no content. Remove any HTML elements or text within the section element.

js
assert.lengthOf(document.querySelectorAll('main > section')?.[2]?.children, 0);

--seed--

--seed-contents--

html
<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <section>
        <h2>Cat Photos</h2>
        <p>Everyone loves <a href="https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg">cute cats</a> online!</p>
        <p>See more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a> in our gallery.</p>
        <a href="https://freecatphotoapp.com"></a>
      </section>
--fcc-editable-region--
      <section>
        <h2>Cat Lists</h2>
        <h3>Things cats love:</h3>
        <ul>
          <li>catnip</li>
          <li>laser pointers</li>
          <li>lasagna</li>
        </ul>
        <figure>
          
          <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>
          
          <figcaption>Cats <strong>hate</strong> other cats.</figcaption>  
        </figure>
      </section>
      
--fcc-editable-region--
    </main>
  </body>
</html>