I'm trying to make my website responsive using a media query, but the styles inside it are not applying on my phone, even though I'm sure the screen width is under 768px.
body {
background-color: white;
}
@media screen and (max-width: 768px) {
body {
background-color: lightblue;
}
}
It works when I resize my desktop browser, but not when I open the same page on my phone.
Things I’ve tried:
Clearing browser cache
Testing on multiple phones
Making sure the CSS file is properly linked
Is there something I'm missing? Do I need to set a specific viewport in the HTML?
viewportmeta element? That is really the absolute basis of proper responsive layout for mobile devices. developer.mozilla.org/en-US/docs/Web/HTML/Guides/…