/GTK 4.0

GTK CSS Properties

GTK supports CSS properties and shorthands as far as they can be applied in the context of widgets, and adds its own properties only when needed. All GTK-specific properties have a -gtk prefix.

All properties support the following keywords: inherit, initial, unset, with the same meaning as defined in the CSS Cascading and Inheritance spec.

The following units are supported for basic datatypes:


px, pt, em, ex, rem, pc, in, cm, mm, calc()


%, calc()


deg | grad | turn, calc()


s | ms, calc()

Length values with the em or ex units are resolved using the font size value, unless they occur in setting the font-size itself, in which case they are resolved using the inherited font size value.

The rem unit is resolved using the initial font size value, which is not quite the same as the CSS definition of rem.

The calc() notation adds considerable expressive power. There are limits on what types can be combined in such an expression (e.g. it does not make sense to add a number and a time). For the full details, see the CSS3 VAlues and Units spec.

A common pattern among shorthand properties (called four sides) is one where one to four values can be specified, to determine a value for each side of an area. In this case, the specified values are interpreted as follows:

4 values:

top right bottom left

3 values:

top horizontal bottom

2 values:

vertical horizontal

1 value:


© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.