Target tablet size (768px – 1023px) in Magento 2

Hi, I’m trying to target tablet size. Official doc says to target tablet (768px – 1023px) we need to use

// // Tablet // _____________________________________________ // This will add styles for tablet devices. When using native media-queries, we recommend wrapping your media-queries with media-width Magento mixins or media-target & when (@media-target = 'desktop'), (@media-target = 'all') { @media only screen and (min-width: @screen__m) and (max-width: @screen__xl - 1) { // your code } }

But that does not work.

I’m not sure what I’m doing wrong since common, mobile and desktop styles working as expected.

Can anybody help me to target the screen size (768px – 1023px) ?


Edit: Ok, it seems to be a bug with the screen variables, because if I do a regular media query like: only screen and (min-width: 768px) and (max-width: 1023px) {


it works.

submitted by /u/dapfr01
[link] [comments]