Home > Web Front-end > JS Tutorial > js code to determine screen resolution_javascript skills

js code to determine screen resolution_javascript skills

WBOY
Release: 2016-05-16 17:28:43
Original
1369 people have browsed it

Generally we can judge the resolution through the following code

Copy code The code is as follows:


js determines browser resolution

Copy code The code is as follows:

<script><br>function ScreenWidth(){ <br>                                                                                                                                                                                ("800*600" ; ;<br>         }<br>}<br></script>




Note: This js code can be modified and changed to screen.width>=1024 and screen.width=800 in two cases

So I chose to use the following code:

Copy code

The code is as follows:


Use JS to determine different resolutions and call different CSS style files

I recently looked at a website and found that different monitor resolutions call style files differently. Today I wrote an example to study it,

Copy code


The code is as follows:

Untitled Document









Contents in c1.css



Copy code

The code is as follows:

Content inside c2.css

*{ margin:0; padding:0;}

div{ width:1200px; height:400px; margin:0 auto; background:red; color:#fff;}


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template