Presentation styles / Using presentation styles |
Pseudo selectors can be used to apply only when some conditions are fulfilled.
Pseudo selectors are preceded with a colon and can be combined:
<Style name="Table:even:input" > <Style name="Edit:focus" > <Style name="Edit.important:focus" >
When combining several pseudo selectors, the style will be applied if all pseudo selector conditions are fulfilled.
Pseudo selectors have different priorities; the style with the most important pseudo selector will be used when several styles match.
Priority | Pseudo selectors | Condition | GDC | HTML5 | GMA | GMI |
---|---|---|---|---|---|---|
1 |
focus |
The widget has the focus | Yes | Yes | Yes | Yes |
2 |
query |
The widget is in construct mode | Yes | Yes | Yes | Yes |
3 |
display |
The widget is in a display array | Yes | Yes | Yes | Yes |
4 |
input |
The widget is in an input array, input or construct | Yes | Yes | Yes | Yes |
5 |
even |
This widget is on an even row if an list (Table or Tree) | Yes | Yes | No | No |
6 |
odd |
This widget is on an odd row if an list (Table or Tree) | Yes | Yes | No | No |
7 |
inactive |
The widget is inactive | Yes | Yes | Yes | Yes |
8 |
active |
The widget is active | Yes | Yes | Yes | Yes |
9 |
message |
Applies only to text displayed with the MESSAGE instruction | Yes | Yes | Yes | Yes |
10 |
error |
Applies only to text displayed with the ERROR instruction | Yes | Yes | Yes | Yes |
11 |
summaryLine |
Applies only to text displayed in AGGREGATE fields of tables | Yes | Yes | No | No |
Pseudo selectors also define the priority of your styles. A more generic style will be used when the pseudo-selector has a higher priority.
<Style name="Edit.important" > <Style name=":focus" >
The style ":focus" is more generic than "Edit.important"; therefore, it will be used for the focused item, as the pseudo selector is more precise.