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

Adam Smallman
Adam Smallman
4,182 Points

media query for chrome

I add a media query and it works in safari but not in chrome any ideas?

@media screen and (max-width: 800px) {
    .work ul li{
        width: 100%;
    }
}

3 Answers

Are you using sublime-text 3? Because for me media queries don't work with it.

Tom Bedford
Tom Bedford
15,645 Points

Hi Carman, your text editor shouldn't have anything to do with code working or not.

That's what i thought too but if i copy and paste the code into another editor it works if i downgrade to sublime-text 2 it also works.

Tom Bedford
Tom Bedford
15,645 Points

Adam - take a look at this codepen try it in Chrome and Safari it should make the li elements 100% wide and have a red background at < 800px.

Perhaps if you share additional code or make a codepen for your project someone could pinpoint the problem.

Adam Smallman
Adam Smallman
4,182 Points

Thank you for helping me. I figured it out all i need to do was put

flex:none;

and it worked hahaha i don't know why

James Barnett
James Barnett
39,199 Points

> it worked hahaha i don't know why

Well if you don't know why, you've got a problem. We call this cargo cult programming and it's a bad item â„¢