Back to Freecodecamp

Step 5

curriculum/challenges/english/blocks/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md

latest1.3 KB
Original Source

--description--

Below your .header element, create a new div element and assign it a class of gallery. This div will act as a container for the gallery images.

Inside that .gallery element, create nine img elements.

--hints--

You should create a div element in your body element.

js
assert(document.querySelector('body')?.querySelectorAll('div')?.length >= 1);

Your new div element should have a class with gallery set as the value.

js
assert(document.querySelector('body')?.querySelector('.gallery'));

Your new div element should come after your .header element.

js
assert(document.querySelector('header')?.nextElementSibling?.classList?.contains('gallery'));

Your .gallery element should have nine img elements.

js
assert(document.querySelector('.gallery')?.querySelectorAll('img')?.length === 9);

--seed--

--seed-contents--

html
--fcc-editable-region--
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Photo Gallery</title>
    <link rel="stylesheet" href="./styles.css">
  </head>
  <body>
    <header class="header">
      <h1>css flexbox photo gallery</h1>
    </header>
  </body>
</html>
--fcc-editable-region--
css