CSS0001: CSS判断手机 平板 PC

    <style>

        /*手机*/
        @media screen and (max-width:600px){
            .box_2 {
                padding-top: 45px;
                padding-bottom: 50px;
                /* background: #fff; */
                /* 添加背景图片 */
                background-image: url("Home/images/bgP.jpg");
                background-size: 100% 100%;
                background-repeat: no-repeat;
                background-position: center;
            }
        }
        /*平板*/
        @media screen and (min-width:600px) and (max-width:960px){
            .box_2 {
                padding-top: 45px;
                padding-bottom: 50px;
                /* background: #fff; */
                /* 添加背景图片 */
                background-image: url("Home/images/bg2.jpg");
                background-size: 100% 100%;
                background-repeat: no-repeat;
                background-position: center;
            }
        }
        /*PC*/
        @media screen and (min-width:960px){
            .box_2 {
                padding-top: 45px;
                padding-bottom: 50px;
                /* background: #fff; */
                /* 添加背景图片 */
                background-image: url("Home/images/bg2.jpg");
                background-size: 100% 100%;
                background-repeat: no-repeat;
                background-position: center;
            }
        }

    </style>

 

posted @ 2020-03-10 15:10  琥珀君  阅读(3091)  评论(0编辑  收藏  举报