Search code examples
htmlcssmedia-queries

Hiding div element without hiding a part of div


I've got a problem which I have no idea how to get around of. I use a shop script where I can only edit CSS file. I have a div with background-image and in there I have a normal image:

<style type="text/css">
.someclassforcss img{
some:attributes;
}
.someclassforcss {
background-image:url(/link.png);
}
</style>
<div class="someclassforcss">
            <img src="/link2.png">
</div>

Everything's good, but I want to use media queries (or any other method) to hide background-image of div for mobile devices, but I have no idea how to make it, because media queries doesn't work for specific attributes, only for whole elements, so if I would've hided the div, my img is also hided which i don't want.


Solution

  • Try this:

    @media only screen and (max-width: 767px){
     .someclassforcss {
       background: none;
     }
    }