-3

enter image description hereI need to remove a picture (using css) if a device visits that is a mobile user. I’ve tried media queries with the display:none and many other things And nothing. Maybe I’m just not using proper syntax or putting it in the right spot? Some help would be greatly appreciated. Thanks!

  • 8
    "*Maybe I’m just not using proper syntax*". We can't possibly know unless you share your code. But a media query with `display: none` is indeed the way you should be going about it. – Obsidian Age Mar 14 '19 at 02:35
  • Show us your code so that we can see what's wrong with your code. – yqlim Mar 14 '19 at 02:35
  • @obsidian Age Ok sorry about that guys. Thought i had my code in there but i guess not. There should be a link to my code now. – Harry qwerty Mar 14 '19 at 04:24
  • @yong Quan Ok sorry about that guys. Thought i had my code in there but i guess not. There should be a link to my code now. – Harry qwerty Mar 14 '19 at 04:24
  • Please provide code as text. Code as images are unhelpful as we then have to re-type out the code. Please read about [MCVE] and [Stack Snippets](https://meta.stackoverflow.com/a/358993/4665) to help get actual code into your questin. – Jon P Mar 14 '19 at 04:32
  • How can you use withing ! As far i know , contains only meta data like link, style.... You can do it with multiple way, Easiest way is using media query with display: none You can use js function getboundingclientrect, screen.width e.t.c to know the device width and according to width you can set your css class. https://stackoverflow.com/questions/6850164/get-the-device-width-in-javascript And your – Robin Mar 14 '19 at 04:34

1 Answers1

0

In the example you've posted, the stylesheet is targeting the class:

.post .sc_image img

but your code example only shows an image tag without the parent containers that have the .post .sc_image classes.

You'd expect to see the image inside some divs (etc) like this:

<div class="post">
  <div class="sc_image">
    <img />
  </div>
</div>

For your example to work correctly, remove .post .sc_image out of your css.

However, I'd guess that these other classes are because your complete code has more to it than just the tag sitting by itself. With that in mind, I would assume that some other style within your application is overwriting the display:none property.

Aaron Lavers
  • 967
  • 9
  • 31