CSS <percentage> Data Type

Description

The <percentage> CSS data type represents a number of measurement relative to another value. It consists of a decimal or integer number immediately followed (without whitespace) by the percent sign, %.

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

<p class="box">Example of the percentage CSS data type.</p>
.box {
    border: 2px solid purple;
    width: 75%;
    height: 100px;
    border-radius: 10%;
    font-size: 120%;
    padding: 20px;
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
31211Yes1
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
≤37184Yes1Yes

Last updated by CSSPortal on: 9th December 2019