1.min-width从小到大书写,max-width从大到小书写
.img_div{
width:5rem !important;height:7rem !important;
}
@media screen and (min-width: 340px) {
.img_div{
width:6rem !important;
height:8.4rem !important;
}
}
@media screen and (min-width: 410px) {
.img_div{
width:7rem !important;
height:9.8rem !important;
}
}
@media screen and (min-width: 600px) {
.img_div{
width:11rem !important;
height:15.4rem !important;
}
}
2.min-width与max-width一起使用
@media screen and (min-width:600px) and (max-width:960px)
3.(摘抄)写法
<link rel="stylesheet" type="text/css" href="style.css" media="screen and (min-width: 600px) and (max-width: 800px)">
意思是当屏幕的宽度大于600小于800时,应用style.css文件设置样式