一、使用js加载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <link href="" rel="stylesheet" type="text/css" id="css" /> <script> var w=window.screen.width;//先获取屏幕分辨率大小 var c; if (w==1280) { c="a.css"; } else i f(w==1024) { c="b.css"; } else if (w==800) { c="c.css"; } else { c="d.css"; } document.getElementById("css").href=c; </script> </head> <body>正文</body> </html> |
二、CSS3 @media 查询
|
...... <link rel="stylesheet" media="screen and (min-width:800px) and (max-device-width:1200px)" href="css/c1.css"/> <link rel="stylesheet" media="screen and (max-width:800px)" href="css/c2.css"/> ...... |