响应式布局,一套代码,适配多个设备。
原理,利用了css的媒体查询
使用方法
/* //pc端 */
@media screen and (max-width:1200px) {
.div1 div {
width: 100%;
height: 100px;
}
.div2 div {
width: 100%;
height: 100px;
}
}
/* ipa端 */
@media screen and (max-width:1000px) and (min-width:700px) {
.div1 div {
width: 50%;
}
.div2 div {
width: 25%;
}
}
/* 手机端 */
@media screen and (max-width:1000px) and (min-width:600px) {}
.div2 div:last-child {
display: none;
}