Site logo

Archived topic

Having code disable on tablet only

3 replies · Started by Matthew on January 25, 2019

Viewing posts 1–4 of 4

Hi there,

I tried to see if this has been asked before but couldn't find anything. I would like to have some code disable on tablet only.

Its a Wordpress widget so I can't add a class to it to use "Using our hide-on-* classes" from docs.

https://docs.generatepress.com/article/responsive-display/

So I need to use @media however there isn't an option for mobile and desktop, just one or the other.

I tried writing the following:

@media (max-width: 768px) and (min-width: 1025px) {
	#text-2 {
		display: none;
	}
}

However, this didn't work. The actual #text-2 part isn't really relevant this bit works, its to do with the media query.

Any ideas what I am doing wrong or I am completely on the wrong path?

Cheers!

Hi there,

the media query is the wrong way round ie. @media (max-width: 1025px) and (min-width: 768px)

Ahh! I knew it would be something to do with the numbers. Was getting so confused.

Cheers all sorted :)

Haha easily done. Glad to be of help.

This archived topic is closed to new replies.