我的媒体查询存在问题,因为它并不是互相覆盖。第一次迭代(max-width: 960px)
工作正常,但第二个(max-width: 380px)
不起作用,我不知道为什么。非常感谢帮助,谢谢。媒体查询不互相覆盖
.fb {
width: 50px;
margin-left: 20px;
margin-right: 20px;
}
@media only screen and (max-width: 960px) {
/* this works */
.fb {
position: relative;
width: 40px!important;
margin-left: 15px!important;
margin-right: 15px!important;
}
}
@media only screen and (max-width: 380px) {
/* this does not work */
.fb {
width: 30px!important;
margin-left: 10px!important;
margin-right: 10px!important;
}
}
<div class="social_container">
<a href="https://www.facebook.com/" target="_blank"><img class="fb" src= "http://placekitten.com/200/300" alt=""></a>
</div>
为什么'!important'?另外,您最后一条规则中有一个错字:“margin-rigth”。什么“不起作用”? – connexo
你可以发布一个有效的小代码片段与示例图像吗?我们无法调试我们无法看到的内容。 –
好的,只需一秒钟。 –