Reputation: 1658
The title describes it.
I have CSS media queries like
@media only screen and (max-width: 1080px){...}
(also tried without the "only screen and")
They work flawlessly on localhost with a smartphone. But when i commit the code to heroku, media queries refuse to work and give me the exact same website as on desktop.
Any suggestions?
Upvotes: 0
Views: 475
Reputation: 1
I ran into this issue as well. I don't know if you are using some web framework like I am, but if so you may be running into an issue with how your css files are being incorporated.
I am using Django, and resolved this issue by installing Whitenoise, which is a project that assists in serving static files within Django apps. Heroku has a helpful article.
Basically:
Everything seems to be working fine for me now. Shouldn't have to include the media queries in the view or flag any css as important.
Upvotes: 0
Reputation: 2321
Try this @media only screen and (max-width: 800px) {}
And try to add it in the view not in the css file
<style type="text/css">
@media only screen and (max-width: 800px) {}
</style>
Upvotes: 1
Reputation: 1140
Make sure you have this line in your index.html file:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Upvotes: 0