html 媒体查询

来源:互联网 发布:电脑音效软件大全 编辑:程序博客网 时间:2024/05/17 23:36
<!-- 设置颜色随着窗口的大小而变换-->    <!-- 有先后顺序 如果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>
0 0