css media queries: target mobile devices without specifying width, pixel ratio, etc

后端 未结 3 2118
日久生厌
日久生厌 2021-02-09 20:46

Let\'s say I just want to target every tablet and phone, regardless of size, is there a media query for this? Is it possible to do this without specifying a size? Or is using a

3条回答
  •  无人共我
    2021-02-09 21:18

    I don't think you'll have too much luck with a pure css approach. You'll want to do something along the lines of the modernizer.js approach and us JS to detect device and append a class name to body based on that.

    What is the best way to detect a mobile device in jQuery?

    Then include that class in your media queries to special case mobile devices of varying sizes.

提交回复
热议问题