<!-- 设置颜色随着窗口的大小而变换--> <!-- 有先后顺序 如果min-width的话,显示顺序从上往下,所以大小设置应该从小到大--> <!-- 如果是max-width 大小设置应该是从大到小--> <style> body{ background-color:red; } @media all and (min-width: 500px) { body{ background-color: #4e5bff; } } @media all and (min-width: 700px) { body{ background-color: #c215ff; } } </style><style> body{ background-color:red; } @media all and (max-width: 700px) { body{ background-color: #4e5bff; } } @media all and (max-width: 500px) { body{ background-color: #c215ff; } } </style>
</head><body></body>
html 媒体查询
最新推荐文章于 2024-06-28 17:35:49 发布