[英]How to hide image when resizing using max-device-width?
當我在移動設備上查看時,需要使img消失
<div id="art">
<img src="../images/canO.jpg" alt="" width="500" height="500"/>
</div>
@media screen and (max-device-width:450px) {...}}
使用此媒體查詢。
@media screen and (max-device-width:450px) { #art img{ display:none; } }
我不明白你在問什么。 如果不是您需要的解決方案,請進一步解釋您的問題。 :) :)
對不起,匆匆我想寫這樣的DEMO
@media screen and (max-width:450px){
#art img{
display:none;
}
}
or
@media screen and (max-width:450px){
#art img{
visibility: hidden;
}
}
你是這個意思?
@media screen and (max-device-width:450px){
#art img{
display:none;
}
}
@media screen and (max-device-width:450px) { .art img { display: none !important;}
您可以隱藏整個div #art { display:none; }
#art { display:none; }
或向圖像添加一個類。 另外,也可以使用#art img { display:none; }
#art img { display:none; }
我只會使用屏幕寬度,如下所示:
@media screen and (max-width:450px) {
#art {
display:none;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.