Learn CSS Flexbox by Building a Photo Gallery - Step 8

Tell us what’s happening:

I have corrected the code as per reccomendation on the forum yet it is still not working!
Task is to set box-sizing to content-box explicitely using * as a 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 * {
  
    box-sizing:content-box;
    
    }
    


/* User Editable Region */

  border: 5px solid red;
  width: 50%;
}

img {
  width: 100%;
  border: 5px solid blue;
  padding: 5px;
}

Your browser information:

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

Challenge Information:

Learn CSS Flexbox by Building a Photo Gallery - Step 8

without destroying the .gallery selector

please reset the step and place the new selector in a way that is not disturbing other selectors

In what way?Please explain further!

you wrote the new selector inside the .gallery selector, reset the step and do not write inside the .gallery selector

How should I write it?

what are you trying? do you have doubts on the css syntax? telling you what to write is against forum policy

 * .gallery  {
  box-sizing: content-box;
}

If you are asked to use a star selector then you need to write that.
* {

  • .gallery * is a descendant selector. It is selecting all * elements that are inside an element with the .gallery class.
<section class="gallery">
  /* all descendant elements */
</section>
  • * .gallery is still a descendant selector, just the other way around. It is selecting all elements with the .gallery class, no matter what element it is located inside. It is also a redundant selector.

  • * on its own selects every element, no matter its position.

1 Like