Home>Article>Web Front-end> How to set minimum width in css
In css, you can use the min-width attribute to set the minimum width. Just add the "min-width:length|%;" style to the element. The value "length" represents a numeric value with length units that defines a fixed-size minimum width; "%" defines a minimum width based on a percentage of the block-level object containing the element.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
The min-width attribute sets the minimum width of the element.
Note: The min-width attribute does not include padding, borders, or margins!
Attribute value:
Value | Description |
---|---|
length | Define the minimum width value of the element. Default: Depends on browser. |
% | Defines the minimum width based on the percentage of the block-level object that contains it. |
Example:
Rendering:
(Learn Video sharing:css video tutorial)
The above is the detailed content of How to set minimum width in css. For more information, please follow other related articles on the PHP Chinese website!