2

Need to have the img disappear when i'm viewing on a mobile device

 <div id="art">
<img src="../images/canO.jpg" alt="" width="500" height="500"/>
</div>

@media screen and (max-device-width:450px) {...}}
Ankit Agrawal
  • 6,034
  • 6
  • 25
  • 49
ranopano
  • 509
  • 2
  • 16
  • 32

5 Answers5

3

Use this media query.

@media screen and (max-device-width:450px) {
#art img{
         display:none;
    }
}

I don't understand properly what you are asking. If it is not the solution what you need, please explain your question further more. :) :)

mAm aazeer
  • 74
  • 5
1

Sorry , hurried I wanted to write like this DEMO

@media screen and (max-width:450px){
    #art img{
        display:none;
    }
}

or

   @media screen and (max-width:450px){
        #art img{
             visibility: hidden;
        }
    }
Alex Wilson
  • 2,421
  • 11
  • 13
0

You mean this?

@media screen and (max-device-width:450px){
    #art img{
        display:none;
    }
}
maťo
  • 1,225
  • 8
  • 16
0
@media screen and (max-device-width:450px) {  .art img { display: none !important;} 
himanshu
  • 1,732
  • 1
  • 11
  • 12
0

You can hide the whole div #art { display:none; } or add a class to the image. Alternatively hide the images in the div with #art img { display:none; }

I would just use screen-width, like so:

@media screen and (max-width:450px) {   
  #art {         
     display:none;
  } 
}
fhollste
  • 785
  • 6
  • 16