弹性web UI的核心:媒体查询

官方手册CSS3 media query

demo

宽度最小700px的屏幕

@media (min-width: 700px) { ... }

宽度在500px和800px之间的屏幕:

@media screen and (min-width: 500px) and (max-width: 800px) { ... }

向显示在最大宽度800px的屏幕上的文档应用样式表

<link rel="stylesheet" media="screen and (max-device-width: 799px)" />

伪范式

media_query_list:  [,  ]*
media_query: [[only | not]?  [ and <expression> ]*]
  | <expression> [ and <expression> ]*
expression: (  [: ]? )
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

你可能感兴趣的:(WEB,css,css3,ui,web)