简单媒体查询的实现






Document - 锐客网

div{
height: 100px;
/*background: pink; */
background: green;
}
/*当页面容器小于768px,显示粉红色。768-992px,显示红色。992-1200蓝色,1200以上绿色*/
/*max-width:1200px*/
@media screen and (max-width:1200px){
div{
background: blue;
}
}
@media screen and (max-width:992px){
div{
background: red;
}
}
@media screen and (max-width:768px){
div{
background: pink;
}
}



/* @media screen and (min-width:768px){
div{
background: red;
}
}
@media screen and (min-width:992px){
div{
background: blue;
}
}
@media screen and (min-width:1200px){
div{
background: green;
}
}*/





    推荐阅读