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

    Introduction

    The width CSS property specifies the width of an element. By default, the property defines the width of the border area. If box-sizing is set to content-box, however, it instead determines the width of the content area.

    The min-width and max-width properties override width.

    Examples

    Syntax

    /* <length> values */
    width: 300px;
    width: 25em;
    
    /* <percentage> value */
    width: 75%;
    
    /* Keyword values */
    width: max-content;
    width: fit-content;
    width: fit-content(20em);
    width: auto;

    Values

    • auto

      Default value. lynx will calculate and select a width for the specified element.

    • <length>

      <length> defines the width as a distance value.

    • <percentage>

      Defines the width as a percentage of the containing block's width.

    • max-content

      The intrinsic preferred width.

    • fit-content

      fit-content uses the computed size with the available space replaced by the specified argument.

    Formal definition

    Initial valueauto
    Applies toall elements
    Inheritedno
    Animatableyes
    Percentagesrefer to the width of the containing block

    Formal syntax

    Difference with the web

    • By default, the property defines the width of the border area, while Web is content area.
    • min-content is not supported.

    Compatibility

    LCD tables only load in the browser

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.