@media适用于除台式机之外的所有设备

时间:2013-02-24 18:46:14

标签: css3 iphone-web-app iphone-standalone-web-app

有没有办法查询所有手持设备/智能手机的css- @ media,与其尺寸(宽度,高度)无关。

我知道,我不能使用@handheld。

我试过这种方式:

@media only screen and (orientation: portrait) or (orientation:landscape){

}

就这样:

@media only screen and (max-device-width:3000px) or (max-device-height: 1300px){

}

但它不起作用。我不想给一堆与几十种不同尺寸的smartpone相关的@ media-queries。有没有办法通过@media查询来指示掌上电脑?我不想通过javascript使用浏览器嗅探。

1 个答案:

答案 0 :(得分:1)

所有可用的媒体都是那些,所以我猜不是:

media_query_list: <media_query> [, <media_query> ]*
media_query: [[only | not]? <media_type> [ and <expression> ]*]
  | <expression> [ and <expression> ]*
expression: ( <media_feature> [: <value>]? )
media_type: all | aural | braille | handheld | print |
  projection | screen | tty | tv | embossed
media_feature: width | min-width | max-width
  | height | min-height | max-height
  | device-width | min-device-width | max-device-width
  | device-height | min-device-height | max-device-height
  | aspect-ratio | min-aspect-ratio | max-aspect-ratio
  | device-aspect-ratio | min-device-aspect-ratio | max-device-aspect-ratio
  | color | min-color | max-color
  | color-index | min-color-index | max-color-index
  | monochrome | min-monochrome | max-monochrome
  | resolution | min-resolution | max-resolution
  | scan | grid

来自https://developer.mozilla.org/en-US/docs/CSS/Media_queries#Pseudo-BNF_(for_those_of_you_that_like_that_kind_of_thing)