Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to call css file according to resolution

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to call the css file according to the resolution". In the daily operation, I believe many people have doubts about how to call the css file according to the resolution. The editor consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful for you to answer the question of "how to call the css file according to the resolution". Next, please follow the editor to study!

Depending on the resolution, call different css file methods. Different browsers call different CSS files.

Put the following JS code into the and tag, this JS code is used to identify the browser resolution

Explanation:

Var IE1024= ""

Var IE800= ""

Var IE1152= ""

Var IEother= ""

Fill in the quotation marks separately, the name of the css file to be used by the user when using IE and the resolution is 1024 "768800" 600 "6152" 864.

Var Firefox1024= ""

Var Firefox800= ""

Var Firefox1152= ""

Var Firefoxother= ""

Fill in the quotation marks separately, the name of the css file to be used by the user when using FF and the resolution is 1024 "768800" 600 "6152" 864.

Var Other1024= ""

Var Other800= ""

Var Other1152= ""

Var Otherother= ""

Fill in the quotation marks separately, the css file name that the user uses other browsers and the resolution is 1024 '768800' 600 '1152' 864.

Don't judge the resolution, just judge the browser.

At the suggestion of E.Qiang, compile the following code. Implement to automatically call different CSS according to the browser type.

Call the JS code of different CSS files:

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: just put it in.

At this point, the study on "how to call the css file according to the resolution" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report