I seem to be having trouble getting media queries working on my site. Developers have managed to get these working previously, however any time I try to add any CSS for certain devices I’ve been unable to get it to work.
An example is the below. I’d like to tighten up the margins for desktop only in the below section, so I added the following CSS.
@media only screen and (min-width: 796px)
{
.container
{margin-top: -3em !important;
margin-left: 3em !important;}
}
Hi @EcomRAZ thanks for your response. I’m certain it’s the correct class as it works fine when I take the media query away. However whenever I’ve tried to put a media query in it does not work at all.
I’ve also tried editing the styles.css.liquid file but am unsure what selector to use as there are obviously many .container styles throughout the site. I have also tried giving the section a CSS class which has not helped.
@EcomRAZ could you please let me know what you are using to select this as I have been trying for hours with no luck. I have tried every class and ID I can see and have not been able to implement this. I’m at my wits end. Thank you
After all that and days of frustration it turns out the code I had above where I was putting this code didn’t have a closing bracket lesson learned. Thank you!
That’s great to hear. As per the given code you attached above, the syntax and brackets were fine. That’s why I asked where you are adding that code because when we integrate any code in the file, We need to make sure of that code syntax as well.