Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Sass Basics (retired) Advanced Sass Concepts Working with Media Queries

Diane Carlisle
Diane Carlisle
8,437 Points

Media Query on Code Challenge

I need help with this one.

#menu {
  ul {
    li {
      @media screen and (max-width: 500px){
        text-align: center;
      }
    }
  }
}

4 Answers

idan ben yair
idan ben yair
10,288 Points

Your code should look something like that.

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

.menu ul li {
text-align: center;
}
}

Hope that helped :)

Looks like you referenced the "menu" class while Diane was referencing the id instead, not sure which one is actually right since I don't know the code challenge specifically, but that is kind of a crucial difference.

Hi Diane,

The only issue is that the ul is the element with the id of "menu". You have it set up as if the ul is within another element that has an id of menu.

You would want to use ul#menu or #menu and remove the nested ul block.

#menu {
  li {
    @media screen and (max-width: 500px) {
      text-align: center;
    }
  }
}
Diane Carlisle
Diane Carlisle
8,437 Points

Still getting bummer error, even with that.

Open a scope on an <ul> with the ID menu. Inside that, open a scope on a <li> element. Using Sass nesting, add a media query so that the <li> elements will have an attribute of text-align: center when the media is screen and the <li> has a max-width of 500px.

I tried to follow word for word, but it gets pretty confusing.

idan ben yair
idan ben yair
10,288 Points

oh very strange!

I'll try to figure out an answer for you but I know what you mean it could be confusing at times.

Diane Carlisle
Diane Carlisle
8,437 Points

Thanks for the feedback! Finally got through it. On to the next challenge! lol