Final Namespace sap.ui.core.CSSSizeModule: sap/ui/core/library

A string type that represents CSS size values.

The CSS specifications calls this the '<length> type'. Allowed values are CSS sizes like "1px" or "2em" or "50%". The special values auto and inherit are also accepted as well as mathematical expressions using the CSS3 calc(expression) operator.

Note that CSS does not allow all these values for every CSS property representing a size. E.g. padding-left doesn't allow the value auto. So even if a value is accepted by sap.ui.core.CSSSize, it still might have no effect in a specific context. In other words: UI5 controls usually don't extend the range of allowed values in CSS.


Valid font-relative units are em, ex and rem. Supported absolute units are cm, mm, in, pc, pt and px. Other units are not supported yet.

Mathematical Expressions

Expressions inside the calc() operator are only roughly checked for validity. Not every value that this type accepts might be a valid expression in the sense of the CSS spec. But vice versa, any expression that is valid according to the spec should be accepted by this type. The current implementation is based on the CSS3 Draft specification from 22 April 2015.

Noteworthy details:

  • whitespace is mandatory around a '-' or '+' operator and optional otherwise
  • parentheses are accepted but not checked for being balanced (a limitation of regexp based checks)
  • semantic constraints like type restrictions are not checked

Future versions of UI5 might check calc() expressions in more detail, so applications should not assume that a value, that is invalid according to the CSS spec but currently accepted by this type still will be accepted by future versions of this type.