Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

CSS Mobile Width-based Query



6:01 pm on Jun 28, 2013 (gmt 0)

5+ Year Member


I have "master.css" as follows:

@import url("folder/file.css");
@import url("file2.css");
@import url("jquery-ui.css");
@import url("anotherfile.css");
@import url("file5.css");
@media screen and (max-width : 640px) {
@import url("mobile.css");

So theoretically, mobile.css should be applied if the user's screen width is small. But no matter what device I use, I can never get the browser to activate mobile.css. If I remove the @media query, mobile.css is imported properly and works. What am I doing wrong?


7:19 pm on Jun 28, 2013 (gmt 0)

10+ Year Member


Your syntax is invalid as @import should precede all rule sets in a style sheet. The correct way to import with a media query is as follows:

@import url(mobile.css) screen and (max-width:640px);


1:18 pm on Jul 1, 2013 (gmt 0)

5+ Year Member

Thank you! I had never really worked with @import or max-width before in this type of context.

Featured Threads

Hot Threads This Week

Hot Threads This Month