For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/properties/max-width.md.
Lynx
  • 简体中文
  • max-width

    介绍

    设置元件的最大宽度。它可以阻止 width 属性的应用值大于 max-width 的值。 max-width 的值会覆盖 widthmin-width

    使用示例

    语法

    /* <length> */
    max-width: 120px;
    max-width: 10em;
    
    /* <percentage> */
    max-width: 75%;

    取值

    默认盒子宽度没有限制

    <length>

    <length> 定义了一个确定值。

    <percentage>

    以包含区块的宽度百分比定义 max-width

    形式定义

    初始值盒子宽度没有限制
    适用元素所有元件
    是否支持继承
    是否支持动画yes
    百分比refer to the width of the containing block

    形式语法

    max-width = <length-percentage [0,∞]>
    
    <length-percentage> =
      <length>      |
      <percentage>

    与 Web 的区别

    mdn: max-width

    1. 不支持 nonemax-contentmin-contentfit-content
    2. 在 Lynx 中 max-width 会覆盖 min-width
    3. 在 Lynx 中,如果指定的 max-width 小于 min-width,则 min-width 会被忽略。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。