This method supports IE browsers and other browsers.
1, first define two link, of course you can also be one, the second is to change the CSS
Copy Code code as follows:
<link rel= "stylesheet" type= "Text/css" href= "Main.css"/>
<link id= "Size-stylesheet" rel= "stylesheet" type= "Text/css" href= "Narrow.css"/>
2, the following JavaScript code will be based on different browser size, change the CSS
Copy Code code as follows:
function Adjuststyle (width) {
width = parseint (width);
if (Width < 701) {
$ ("#css"). attr ("href", "css/narrow.css");
else if ((width >= 701) && (Width < 900)) {
$ ("#css"). attr ("href", "css/medium.css");
} else {
$ ("#css"). attr ("href", "<?php bloginfo (' Stylesheet_url ');?>");
document.write ("Css/style.css")
}
}
$ (function () {
Adjuststyle ($ (this). width ());
$ (window). Resize (function () {
Adjuststyle ($ (this). width ());
});
});
The above code is tested and available!!