CSS Data Type
Description
The <percentage> CSS data type represents a value relative to another value, typically expressed as a fraction of 100. Percentages are most often used to define dimensions, spacing, or positioning in relation to a parent container or another reference point, allowing for flexible and responsive layouts. Unlike absolute units like <length>, percentages adapt dynamically when the size of the reference element changes, making them highly useful in modern, fluid web design.
For example, when setting the width of a block element, a percentage defines the width as a proportion of its parent element:
.container {
width: 80%; /* 80% of the parent element's width */
}
Percentages are also frequently used in conjunction with properties such as top, left, margin, and padding. In these contexts, the percentage value is calculated relative to the dimensions of the containing element. For instance, vertical margins as a percentage are relative to the width of the containing block, which can sometimes produce unexpected results:
.box {
margin-top: 10%; /* 10% of the containing element's width */
padding-left: 5%; /* 5% of the containing element's width */
}
<percentage> values are also used in properties like transform for scaling or translations, and in clip-path for defining regions of elements. Because percentages are relative, they allow designs to remain proportional and responsive across different screen sizes, making them a core tool in flexible layouts and modern CSS design patterns.
.progress {
width: 50%; /* progress bar fills 50% of parent width */
height: 20px;
background-color: blue;
}
This flexible behavior makes <percentage> one of the most versatile CSS data types for responsive and adaptive design.
Syntax
property: <percentage>
Values
- <percentage>Consists of a <number> followed by the percentage sign (%). Optionally, it may be preceded by a single + or - sign, although negative values are not valid for all properties.
Example
Browser Support
The following information will show you the current browser support for the CSS percentage data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 3rd January 2026
