← Back to properties

CSS Property

width

Sizing

Sets the width of an element's content area.

Syntax

width: value;

Example

width: 100%;

Common use cases

  • Full-width containers
  • Fixed-width sidebars
  • Responsive elements with percentage widths

Practical developer insight

width: 100% means 100% of the parent — not the viewport. Use width: 100vw for full viewport width, but watch for horizontal scroll caused by scrollbar width.

Related properties