Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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