纵横比 | @media.aspect-ratio (Media Queries) - CSS 中文开发手册 - Break易站
2021-01-27 05:14
纵横比 | @media.aspect-ratio (Media Queries) - CSS 中文开发手册
该aspect-ratio CSS @media媒体功能可用于应用基础上的纵横比视觉效果。
语法
该aspect-ratio特征被指定为
例
HTML
Watch this element as you resize your viewport‘s width and height.
CSS
/* Exact aspect ratio */ @media (aspect-ratio: 1/1) { div { color: red; } } /* Minimum aspect ratio */ @media (min-aspect-ratio: 8/5) { div { background: yellow; } } /* Maximum aspect ratio */ @media (max-aspect-ratio: 2/1) { div { border: 2px solid blue; } }
结果
规范
Specification | Status | Comment |
---|---|---|
Media Queries Level 4The definition of ‘aspect-ratio‘ in that specification. | Working Draft | No change. |
Media QueriesThe definition of ‘aspect-ratio‘ in that specification. | Recommendation | Initial definition. |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | ? | 3.5 (1.9.1) | 9.0 | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |
上一篇:asp.net core 3.1部署到centos7.3服务器
下一篇:用户变焦 | @viewport.user-zoom (Device Adaptation) - CSS 中文开发手册 - Break易站
文章标题:纵横比 | @media.aspect-ratio (Media Queries) - CSS 中文开发手册 - Break易站
文章链接:http://soscw.com/index.php/essay/47606.html