Broken lesson step 20

Tell us what’s happening:
Describe your issue in detail here.

@media only screen and (max-width: 800px) {

  #gallery img {

    width: 50%;

  }

}
  **Your code so far**
\ file: <!DOCTYPE html>
<html>
<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>
  <div class="header">
    <h1>CSS FLEXBOX PHOTO GALLERY</h1>
  </div>
  <div id="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"/>
    <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/10.jpg"/>
  </div>
</body>
</html>
<!DOCTYPE html>
<html>
<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>
  <div class="header">
    <h1>CSS FLEXBOX PHOTO GALLERY</h1>
  </div>
  <div id="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"/>
    <img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/10.jpg"/>
  </div>
</body>
</html>
\ file: * {
box-sizing: border-box;
}

body {
margin: 0;
font-family: Arial;
background: #EBE7E7;
}

.header {
text-align: center;
padding: 32px;
background: #E0DDDD;
}

#gallery {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 0 4px;
}

#gallery img {
width: 25%;
height: 300px;
object-fit: cover;
margin-top: 8px;
padding: 0 4px;
border-radius: 10px;
}

@media only screen and (max-width: 800px) {
#gallery img {
  width: 50%;
}
}
* {
box-sizing: border-box;
}

body {
margin: 0;
font-family: Arial;
background: #EBE7E7;
}

.header {
text-align: center;
padding: 32px;
background: #E0DDDD;
}

#gallery {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 0 4px;
}

#gallery img {
width: 25%;
height: 300px;
object-fit: cover;
margin-top: 8px;
padding: 0 4px;
border-radius: 10px;
}

@media only screen and (max-width: 800px) {
#gallery img {
  width: 50%;
}
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0

Challenge: Step 20

Link to the challenge:

35

36

37

38

39

Step 20

Create a media query for screens smaller than 800px in width. In that media query, create a #gallery img rule and set the width property to 50% . This will convert your gallery to a two-column layout.

Test

Sorry, your code does not pass. You’re getting there.

Hint

Your new @media query should have a max-width of 800px .

HI @cheapsk8studios !

Welcome to the forum!

The tests are looking for @media not @media only screen and
When I change that, then the tests passes for me

3 Likes

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

Yes, I figured it out right after I posted… DOH!!! Thanks! :slight_smile:

How did you resolve this exercise?
I’m stuck on it…

Hi, if searching online for information hasn’t helped, such as the W3 page on media queries, nor has looking at the forum for posts explaining lesson, please click ‘new topic’ from this forum or ‘ask for help’ on the lesson.

It is much easier to help you if you make a new topic post.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.