If you want that this media queries will be available only in mobile devices, i would use JS to identify the device and load the css queries file. For example, something like this:
const ifIsMobile = { // detect the mobile devices
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (ifIsMobile.Android() || ifIsMobile.BlackBerry() || ifIsMobile.iOS() || ifIsMobile.Opera() || ifIsMobile.Windows());
}};
const loadMobileCss = () => { // add the link tag to load mobilestyles.css
const linke = document.createElement("link");
linke.rel = "stylesheet";
linke.href = "mobilestyles.css";
document.getElementsByTagName("head")[0].appendChild(linke);
}
if (ifIsMobile.any()) loadMobileCss(); // if the device is mobile, load mobilestyles.css with the function loadMobileCss()
You have to put this code in the head of your web to make this work.
(max-width: 415px)will only trigger when screen size is 415px or lower. Hence, there could be something else which is causing you the problem