width of media queries

CSS3

Media Queries: width

  • 版本:CSS3
  • 是否接受min/max:是

语法:

width<length>

取值:

<length>
用长度值来定义宽度。不允许负值

说明:

定义输出设备中的页面可见区域宽度。
  • 盒模型width不同,媒体特性width的取值只能是<length>
  • 本特性接受min和max前缀,因此可以派生出min-widthmax-width两个媒体特性。
  • 简单列举几个应用示例:

    @media screen and (width){ … }
    @import url(example.css) screen and (width:800px);
    <link media="screen and (min-width:400px) and (max-width:900px)" rel="stylesheet" href="example.css" />
    <?xml-stylesheet media="not screen and (width:800px)" rel="stylesheet" href="example.css" ?>

兼容性:

  • = 支持
  • = 不支持
  • = 部分支持
支持版本\类型
较早版本 6-8 4 5.1.7 13 11.5
较近版本 9

示例: