Learn CSS Flexbox by Building a Photo Gallery - Step 7

Tell us what’s happening:

Step 7: Sorry, your code does not pass. Hang in there.

You should have an img selector.

Your code so far

<!-- file: index.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">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/1.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/2.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/3.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/4.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/5.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/6.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/7.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/8.jpg">
      <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/9.jpg">
    </div>
  </body>
</html>
/* file: styles.css */

/* User Editable Region */

.gallery {
    width: 50%;
    border: 5px solid red; /* Visual border for the gallery */
}

.gallery img {
    width: 100%;          /* Each image takes the full width of the gallery */
    padding: 5px;        /* Padding around each image */
    border: 5px solid blue; /* Border for each image */
}



/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Challenge Information:

Learn CSS Flexbox by Building a Photo Gallery - Step 7

Do you know how to write an img selector? It seems they want this?

This is my code my selector is .gallery img

.gallery {
width: 50%; /* Set the gallery width to 50% /
border: 5px solid red; /
Add a red border to the gallery */
}

.gallery img {
width: 100%; /* Each image takes the full width of the gallery /
padding: 5px; /
Add padding around each image /
border: 5px solid blue; /
Add a blue border to each image */
}

If the instructions are usually very explicit about that to do, try following the instructions exactly word for word.

They don’t ask for “a selector for images within the gallery class”

it just state an
img selector
not in a descendant selector.