Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Os nossos voluntários ainda não traduziram este artigo para Português (Europeu) . Junte-se a nós e ajude-nos a fazer o trabalho!

The computed value of a CSS property is computed from the specified value by:

  • Handling the special values inherit and initial, and
  • Doing the computation needed to reach the value described in the "Computed value" line in the property's summary.

The computation needed to reach the computed value for the property typically involves converting relative values (such as those in em units or percentages) to absolute values.

For example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size).

However, for some properties (those where percentages are relative to something that may require layout to determine, such as width, margin-right, text-indent, and top), percentage specified values turn into percentage computed values. Additionally, unitless numbers specified on the line-height property become the computed value, as specified. These relative values that remain in the computed value become absolute when the used value is determined.

The main use of the computed value (other than as a step between the specified value and used value) is inheritance, including the inherit keyword.

Notes

The getComputedStyle() DOM API returns the resolved value, which may either be the computed value or the used value, depending on the property.

Specifications

Specification Status Comment
CSS Level 2 (Revision 1)
The definition of 'computed value' in that specification.
Recommendation Initial specification

See also

Etiquetas do documento e colaboradores

Etiquetas: 
 Última atualização por: Cath_kb,