Home>Article>Web Front-end> Calling css file methods with different resolutions

Calling css file methods with different resolutions

php中世界最好的语言
php中世界最好的语言 Original
2017-11-29 10:14:16 1755browse

We know that one of the most feared things when doing front-end development is resolution and the other is compatibility, so today we will solve the problem of calling different resolutions. Let’s take a look

Put the following JS code into the 93f0f5c25f18dab9d176bd4f6de5d30e and 9c3bca370b5104690d9ef395f2c5f8d1 tags. The function of this JS code is to identify the browser resolution

Explanation:

var IE1024=""; var IE800=""; var IE1152=""; var IEother="";

Fill in the quotation marks respectively, and the css file name to be used when the user uses IE and the resolution is 1024*768, 800*600, 1152*864.

var Firefox1024=""; var Firefox800=""; var Firefox1152=""; var Firefoxother="";


Fill in the quotation marks respectively, and the css file name to be used when the user uses FF and the resolution is 1024*768, 800*600, 1152*864.

  var Other1024=""; var Other800=""; var Other1152=""; var Otherother="";


Fill in the quotation marks respectively, and the css file name to be used when the user uses other browsers and the resolution is 1024*768, 800*600, 1152*864.


Does not judge the resolution, only judges the browser

In response to E.Qiang's suggestion, the following code was compiled. Automatically call different CSS according to browser type.


Calling different CSS files JS code:

Explanation:

If the browser is IE, call default.css

If the browser is Firefox, call default2.css

If the browser is other, call newsky.css

Usage: Place in 93f0f5c25f18dab9d176bd4f6de5d30e


# I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to convert 2d and 3d HTML

How to use CSS to operate two DIVs overlapping

HTML5 video and audio implementation steps

The above is the detailed content of Calling css file methods with different resolutions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn