如何在媒体查询中设置媒体特性,比如宽度在两个像素之间,比如 300px - 400px?
how to set the media features in media queries, like width is in between two pixels like 300px - 400px?
在媒体查询中
@media screen and (max-width: 300px) {
body {
background-color: lightblue;
}
}
这将在屏幕的最小宽度为 300px 时执行。
如果我想在宽度介于 300px - 500px 之间时执行代码,我将如何编写代码。
@media screen and (min-width: 300px) and (max-width: 500px)
{
body {
background-color: lightblue;
}
}
很简单
@media screen and (max-width: 359px) and (min-width: 240px){
.detail_image{height:160px; width:280px;}
.video_cntrl{height:160px; width:auto;}
}
我强烈建议您使用基于宽高比的分辨率,它会消除您的顾虑。
请view它。
在媒体查询中
@media screen and (max-width: 300px) {
body {
background-color: lightblue;
}
}
这将在屏幕的最小宽度为 300px 时执行。 如果我想在宽度介于 300px - 500px 之间时执行代码,我将如何编写代码。
@media screen and (min-width: 300px) and (max-width: 500px)
{
body {
background-color: lightblue;
}
}
很简单
@media screen and (max-width: 359px) and (min-width: 240px){
.detail_image{height:160px; width:280px;}
.video_cntrl{height:160px; width:auto;}
}
我强烈建议您使用基于宽高比的分辨率,它会消除您的顾虑。
请view它。