|
@@ -0,0 +1,32 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ .box{
|
|
|
+ width: 400px;
|
|
|
+ height: 400px;
|
|
|
+ background-color: blue;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 媒体查询 */
|
|
|
+ /* 当屏幕宽度小于等于500px 时 把box的背景颜色改为红色 */
|
|
|
+
|
|
|
+ @media screen and (max-width:500px){
|
|
|
+ .box{
|
|
|
+ background-color: red;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @media screen and (max-width:800px ) and (min-width:501px){
|
|
|
+ .box{
|
|
|
+ background-color: green;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="box"></div>
|
|
|
+</body>
|
|
|
+</html>
|