|
@@ -0,0 +1,45 @@
|
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
|
+<html lang="en">
|
|
|
|
|
+<head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
+ <title>Document</title>
|
|
|
|
|
+ <!-- 响应式布局 根据屏幕尺寸 来加载不同的css文件 -->
|
|
|
|
|
+ <link rel="stylesheet" media="screen and (max-width:1000px) and (min-width:600px)" href="./css/a.css">
|
|
|
|
|
+ <link rel="stylesheet" media="screen and (min-width:1200px)" href="./css/b.css">
|
|
|
|
|
+ <style>
|
|
|
|
|
+ .box{
|
|
|
|
|
+ width: 1000px;
|
|
|
|
|
+ height: 600px;
|
|
|
|
|
+ background-color: red;
|
|
|
|
|
+ }
|
|
|
|
|
+ /* @media 媒体查询 根据屏幕类型和尺寸 来控制样式 */
|
|
|
|
|
+ @media screen and (max-width:1000px) and (min-width:600px){
|
|
|
|
|
+ .box{
|
|
|
|
|
+ background-color: blue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ @media screen and (min-width:1200px){
|
|
|
|
|
+ .box{
|
|
|
|
|
+ background-color: green;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /* @media 媒体查询 orientation 根据屏幕方向 来控制样式 landscape 横屏 */
|
|
|
|
|
+ @media screen and (orientation:landscape){
|
|
|
|
|
+ .box{
|
|
|
|
|
+ background-color: pink;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /* 竖屏 */
|
|
|
|
|
+ @media screen and (orientation:portrait){
|
|
|
|
|
+ .box{
|
|
|
|
|
+ background-color: yellow;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ </style>
|
|
|
|
|
+</head>
|
|
|
|
|
+<body>
|
|
|
|
|
+ <div class="box">hello world</div>
|
|
|
|
|
+</body>
|
|
|
|
|
+</html>
|