Back to Freecodecamp

Step 21

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

latest2.3 KB
Original Source

--description--

Your images need some space between them.

The gap CSS shorthand property sets the gaps, also known as gutters, between rows and columns. The gap property and its row-gap and column-gap sub-properties provide this functionality for flex, grid, and multi-column layout. You apply the property to the container element.

Give your .gallery flex container a gap property with 16px as the value.

--hints--

Your .gallery selector should have a gap property with 16px set as the value.

js
assert(new __helpers.CSSHelp(document).getStyle('.gallery')?.gap === '16px');

--seed--

--seed-contents--

html
<!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>
    <div class="gallery">
      
      
      
      
      
      
      
      
      
    </div>
  </body>
</html>
css
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background: #f5f6f7;
}

.header {
  text-align: center;
  text-transform: uppercase;
  padding: 32px;
  background-color: #0a0a23;
  color: #fff;
  border-bottom: 4px solid #fdb347;
}

--fcc-editable-region--
.gallery {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 10px;
}
--fcc-editable-region--

.gallery img {
  width: 100%;
  max-width: 350px;
  height: 300px;
  object-fit: cover;
}