A percentage is an integer, or a decimal number, followed by a percentage character (%). Whitespace characters mustn’t appear between the number and the %. For example, here’s a width declaration that uses a percentage value:

#example {
  width: 50%;

A percentage value is, by its nature, relative to something else. The interpretation of percentages differs between CSS properties, so you’ll have to use the reference to find the specific property you’re dealing with, and to identify what its stated percentage value means. In some cases, the interpretation of percentage values can be quite unexpected; for example, vertical padding refers to a percentage of the width—not height—of the containing block.

User-contributed notes

Related Products