Media query for devices supporting hover

后端 未结 6 1309
醉梦人生
醉梦人生 2020-12-08 04:24

I\'d like to provide separate behaviour for browsers supporting hover (e.g. desktop browsers) and ones which don\'t (e.g. touchscreen devices). Specifically I want to declar

6条回答
  •  没有蜡笔的小新
    2020-12-08 04:49

    not should prefix media type (screen, print, all, etc) and not media feature (hover, point, etc).

    Wrong:

    @media not (hover: none)
    

    Correct:

    @media not all and (hover: none)
    

    Yes, its unintuitive and weird. Source (see comments).

    So you do not need javascript to alternate result of media query.

提交回复
热议问题