Issue
I was asked to create a simple website for my assignment. I want the html file to run "mobile.css" when I open the site on mobile and run "desktop.css" when I open the site on mobile.
Solution
There is misunderstood. I assume you want css to work for 'small' aka mobile, and big aka 'desktop'. This is done by css @media queries. This way, most likely we combine these styles in one css file.
e.g. change background for smaller resolution.
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
If you want to detect if user uses mobile browser, you can detect it by css and conditionally load your css.
e.g.
const isMobile = navigator.userAgentData.mobile;
Answered By - arturas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.