Each line of Media Query, separated by commas, must be fully formed (I don’t know that in the specification everything is transferred from one to another ... although some browsers can support shortcuts here, it is reasonable to adhere to the lowest common denominator: specification). (Among other things, this makes testing easier, as simple text mods allow you to test a single media query at the same time.) And, of course, “only” and “no” are mutually exclusive parameters. So I think the syntax should be
@media only screen and (min-width: 768px), not screen and (min-device-width: 768px) and (max-device-width: 1024px) {
(xxx-device-width: and xxx-width: [with the inclusion or exclusion of "-device"] refer to the width of the screen and the width of the viewport / layout, respectively [which are usually the same for "desktop" devices, and for most handheld devices computers, if "viewport" is specified content = "width = device-width"> gt; is specified, but may not match for smartphones without the "viewport" specification in the source HTML file of the page), I usually do not see a mixture of these two in one statement for Media Query, and therefore [although I have not yet tried to understand this example in detail], I suspect something is a little wrong.)
source share