媒体查询的两种方式

第一种:link的方式:

1 <link rel="stylesheet" media="screen and (max-width:600px)" href="./css/blue.css">
2     <link rel="stylesheet" media="screen and (min-width:900px)" href="./css/red.css">
3     <link rel="stylesheet" media="screen and (min-width:1200px)" href="./css/yellow.css">

第二种:css的方式:

    <style>
        @media screen and (max-width:600px) {
            body {
                background-color: blue;
            }
        }

        @media screen and (min-width:900px) {
            body {
                background-color: red;
            }
        }

        @media screen and (min-width:1200px) {
            body {
                background-color: yellow;
            }
        }
    </style>

 

posted @ 2018-01-10 21:45  前端极客  阅读(5524)  评论(0编辑  收藏  举报