I always call mine when I bind CSS in the head of HTML.
An example from the current page I'm working on:
<link rel="stylesheet" type="text/css" media="screen and (min-device-width: 320px) and (max-device-width: 500px)" href="css/mobile.css" /> <link rel="stylesheet" type="text/css" media="screen and (min-device-width: 501px)" href="css/main.css" />
This selects a CSS document that will load from the very beginning instead of choosing styles after loading the CSS document (reduces the number of HTTP requests)
When doing this inside the CSS document itself, you usually need to replace max-device-width with max-width .
mikedugan
source share