<?xml version="1.0" encoding="utf-8"?>

CSS width and height property values

CSS width and height property values

The width and height properties can take different types of values:

  • Length specifies a width or height in px, em, rem, pt, cm, etc
  • Percentage specifies a width in percentage (%) of the width or height of the containing element
  • Keyword values max-content, min-content, fit-content, and auto
  • Global values inherit, initial and unset

You can't specify negative values to the width and height properties.

Improve your UX & Product skills with interactive courses that actually work