This article mainly introduces jquery's method of using different css style sheets for browsers of different sizes. If you need jquery, you can refer to this method to support IE and other browsers.
1. Define two links first. Of course, you can also be one, and the second is the css to be changed.
The Code is as follows:
2. The following JavaScript code will change css based on different browser sizes.
The Code is as follows:
Function adjustStyle (width ){
Width = parseInt (width );
If (width <701 ){
$ ("# Css"). attr ("href", "css/narrow.css? 1.1.9 ");
} Else if (width> = 701) & (width <900 )){
$ ("# Css"). attr ("href", "css/medium.css? 1.1.9 ");
} Else {
// $ ("# Css"). attr ("href "," ");
Document. write ("css/style.css? 1.1.9 ")
}
}
$ (Function (){
AdjustStyle ($ (this). width ());
$ (Window). resize (function (){
AdjustStyle ($ (this). width ());
});
});
The above code has been tested and available !!