您好,我有这个脚本,当屏幕尺寸为1600 pxbackground-color
为红色,而屏幕尺寸为1366 pxbackground-color
为黑色时,我却需要,但是我的代码不起作用,媒体查询仅能工作1600 px
html
<div>
</div>
的CSS
div{
width:100%;
height:100%;
background-color:grey;
}
@media screen and (max-width:1366px){
div{
background-color:black;
}
}
@media screen and (max-width:1600px){
div{
background-color:red;
}
}
第二种样式覆盖第一种样式。更改顺序。会的。
div{
width:100%;
height:100%;
background-color:grey;
}
@media screen and (max-width:1600px){
div
{
background-color:red;
}
}
@media screen and (max-width:1366px){
div
{
background-color:black;
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句