Back to Freecodecamp

Step 13

curriculum/challenges/english/blocks/workshop-flexbox-photo-gallery/6153908a366afb4d57185c8d.md

latest2.5 KB
Original Source

--description--

Flexbox has a main and cross axis. The main axis is defined by the flex-direction property, which has four possible values:

  • row (default): horizontal axis with flex items from left to right
  • row-reverse: horizontal axis with flex items from right to left
  • column: vertical axis with flex items from top to bottom
  • column-reverse: vertical axis with flex items from bottom to top

Note: The axes and directions will be different depending on the text direction. The values shown are for a left-to-right text direction.

Try the different values to see how they affect the layout.

When you are done, set an explicit flex-direction of row on the .gallery element.

--hints--

Your .gallery selector should have a flex-direction property set to row as the value.

js
assert.equal(new __helpers.CSSHelp(document).getStyle('.gallery')?.flexDirection, 'row');

--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;
}


.gallery {
  display: flex;
--fcc-editable-region--
  
--fcc-editable-region--
}

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