Help me to solve this code

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.
my code:

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

  #gallery img {width: 50%;}

}

Hey!
It worked if screen and is omitted…

2 Likes

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

thanks so much ,why did you omit it please?


Apparently, they’re optional :slight_smile: I didn’t know that as well, just tried tweaking the code
CSS @media Rule.

Yes but there you need to omit screen and " and " , so that it works normally.

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