Media Query Question
- Started
- Last post
- 6 Responses
- ArmandoEstrada
Is it possible for media queries to kick in only on mobile devices and not on desktop? In other words, I don't want my site to scale down to the different device sizes when on desktop browsers. Tried to google and cant find answer...
- mg330
I actually have just been learning about this for a project I'm working on.
I don't think this answers your question, but I thought this guide was helpful:
http://css-tricks.com/snippets/c…From a quick look around I don't think there's a way to detect actual devices.
- ETM0
So you're concerned that if someone shrinks their window down to 320px/480px wide, they'll see the mobile layout on a desktop?
- Yes. Not really concerned but I rather they have a non responsive experience.ArmandoEstrada
- ETM0
You can use javascript to decide on what device or resolution detected gets what styles or stylesheet(s). Since that is done onload, it wouldn;t happen dynamically, like when resizing a window.
- Nathan_Adams0
Use some javascript to detect for mobile onload and add a .mobile class to the body. Then in your media queries, place .mobile before every rule.
- sublocked0
Yes, but you're doing it backwards.
Start with a mobile-first mentality so your users on slow connections don't have to download the resources for the bigger site.
Progressive enhancement, young jedi.......