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

Mark Litnewski
Mark Litnewski
7,058 Points

Advanced Sass concepts Stage 4, Working with Media Queries, code challenge 2

Shouldn't this work? Tells me it's wrong. What am I missing?

/* Write your SCSS code below. */
ul #menu {
  li {
    @media screen and (max-width: 500px) {
      text-align: center;
    }
  }
}

@media screen and (orientation: landscape) {
  img {
    width: 360px;
  }
}

You guys might want to set the post edit page so that the topic is pre-populated with the topic it's currently under, btw. When I edited the post it defaulted back to general discussion, which wasn't my intent.

Some context would be needed!

Mark Litnewski
Mark Litnewski
7,058 Points

The instructions are:

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.

The error I'm getting: Bummer! Select 'li' tags within the 'ul' that has an ID of '#menu'. Set their text-align property to center.

6 Answers

Wayne Priestley
Wayne Priestley
19,579 Points

you have ul #menu, if the ul has a id of menu then you should only need to identify it by its id and not ul then its id. The id of menu should be unique to that ul, so no need to include ul.

Take the space out between your ul #menu so its ul#menu

Alfredo Moncayo
Alfredo Moncayo
11,276 Points

PC reads; Select the ul elements that has an id "menu" within this element look for li elements and apply the rules inside the { . . . }

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

No space between ul and its id.

Hope it helps.

Mark Litnewski
Mark Litnewski
7,058 Points

That worked. But the instructions are very misleading. I see now that my instructions didn't quite get displayed in their entirety, but it specifically said to "Open a scope on an ul with the ID menu."

Also, it should still work with the ul in front of it, no?

Either way, thank you!

Wayne Priestley
Wayne Priestley
19,579 Points

The thing is, yes it would work but the question is expecting a specific answer and anything included that it isn't expecting will result in a wrong answer.

Glad to help Mark :)

Mark Litnewski
Mark Litnewski
7,058 Points

Right... They should fix the instructions then. :)