CSS Width

The width property in CSS sets the content width of area of the element. These properties do not provide margin and border features. It is used to set the area’s width within the margin, border, and padding of an element.

Width Values

ValueDescription
autoIt is applied for calculating the width, and it is the default value.
lengthThis value is referred to describe the width property cm, px, etc.
%It describes a containing block’s width in %.
initialThis value sets the CSS Width property to the default value.
inheritThe inherit value inherits this property from one of its parent components.

Example of Width Property: in px

Output:

CSS Width

Pin It on Pinterest

Share This