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:
Length | px, pt, em, ex, rem, pc, in, cm, mm, |
Percentage | %, |
Angle | deg | grad | turn, |
Time | s | ms, |
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: | all |
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/ch39.html