This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

<percentage>

Summary

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, %.

Percentages are expressed relative to other measurements, such as an element’s dimensions, and can fall outside the 0-100% range. What percentages are relative to is different for every property and is specified in the “Percentages” row of its definition.

Examples

.box {
    width: 80%;
          /* relative to the parent container's
              content width */

    border-radius: 50%;
          /* relative to this box's height or width;
              the computed value will be different
              in the x and y directions, creating an
              ellipse. */

    font-size: 120%;
          /* relative to the inherited font size */
}

Related specifications

CSS Values and Units Module Level 3
W3C Candidate Recommendation
CSS 2.1
W3C Recommendation