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

Ethan Neff
Ethan Neff
27,058 Points

Need help solving this problem

Question:

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.

My failed answer:

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

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

1 Answer

Ethan Neff
Ethan Neff
27,058 Points

/solved

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

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