Table of Contents

CSS - Percentage Value

About

The format of a percentage value is a number followed by the character %.

Percentage values are always relative to another value, for example a length.

Each property that allows percentages also defines the value to which the percentage refers.

The value may be that of :

When a percentage value is set for a property of the root element and the percentage is defined as referring to the inherited value of some property, the resultant value is the percentage times the initial value of that property.

Example

p { font-size: 10px }
p { line-height: 120% }  /* 120% of 'font-size' */

Width: 100% how many pixel

With width: 100% is 100% of the containing element.