最大高度 | @viewport.max-height (Device Adaptation) - CSS 中文开发手册 - Break易站
最大高度 | @viewport.max-height (Device Adaptation) - CSS 中文开发手册
max-heightCSS描述符指定通过定义的文档的视口的最大高度@viewportat-rule。
考虑到最大高度约束,初始高度将尽可能接近初始视口高度。
Related at-rule | @viewport |
---|---|
初始值 | auto |
Percentages | refer to the height of the initial viewport |
适用媒体 | visual, continuous |
计算值 | if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto |
正规顺序 | the unique non-ambiguous order defined by the formal grammar |
语法
1 2 3 4 5 6 7 8 9 10 | /* Keyword value */ max-height : auto ; /* <length> values */ max-height : 400px ; max-height : 50em ; max-height : 20 cm; /* <percentage> value */ max-height : 75% ; |
值
auto使用的值是从其他CSS描述符的值中计算出来的。<length>非负的绝对或相对长度。<percentage>相对于初始视口高度的百分比值,垂直长度缩放系数为1.0。必须是非负的。
正式语法
1 2 3 4 | <viewport-length>where <viewport-length> = auto | <length-percentage> where <length-percentage> = <length> | <percentage> |
示例
1 2 3 | @viewport { max-height : 600px ; } |
规范
Specification | Status | Comment |
---|---|---|
CSS Device AdaptationThe definition of '"max-height" descriptor' in that specification. | Working Draft | Initial definition |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 29 (behind a flag) | No support | 10 -ms | 11.10 Removed in 15 Reintroduced behind a flag in 16 | No support |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | 29 | No support | 10-ms | 11.10 Removed in 15 Reintroduced behind a flag in 16 | No support |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· DeepSeek 解答了困扰我五年的技术问题。时代确实变了!
· 本地部署DeepSeek后,没有好看的交互界面怎么行!
· 趁着过年的时候手搓了一个低代码框架
· 推荐一个DeepSeek 大模型的免费 API 项目!兼容OpenAI接口!