1 reply [Last post]
mrswenner
mrswenner's picture
Offline
newbie
Last seen: 5 years 29 weeks ago
Timezone: GMT-5
Joined: 2014-04-30
Posts: 1
Points: 2

I am trying to use the same webpage, but with a different CSS if the user is viewing it with a mobile device as opposed to a computer. I have the following in a CSS called mobile-choose, but it is not working...any thoughts?

/* Phone & Tablet */
@import url("mobile.css") only screen and (max-width:768px);
 
/* Desktop */
@import url("regular.css") only screen and (min-width:769px);

helldog2004
helldog2004's picture
Offline
Enthusiast
Netherlands
Last seen: 3 years 15 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2014-03-02
Posts: 205
Points: 239

In the head

Try to place this in the head of your HTML file instead of inside your CSS file.

<style type="text/css">
@import url("mobile.css") only screen and (max-width:768px);
@import url("regular.css") only screen and (min-width:769px);
</style>

Then it should work.
Let us know if it fixed your problem.
Cheers,
Henk

Check Maximum Webdesign for your online solutions