Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SWT/Devel/Gtk/CSS selector"

< SWT‎ | Devel‎ | Gtk
(Created page with "= Avoiding CSS warnings in console = GTK CSS has a specific format in order to be parsed without warnings. The format is as follows: <widget name/selector> {<property>: <val...")
 
(Avoiding CSS warnings in console)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
GTK CSS has a specific format in order to be parsed without warnings. The format is as follows:
 
GTK CSS has a specific format in order to be parsed without warnings. The format is as follows:
 
   <widget name/selector> {<property>: <value>;}
 
   <widget name/selector> {<property>: <value>;}
 +
 +
For example:
 +
<source lang=css>
 +
GtkWidget {background-color: rgba(255, 0, 0, 255);}
 +
</source>
  
 
Forming CSS strings with this format will not cause any warnings. Additional semi-colons will cause problems. Note that only one semi-colon is needed.
 
Forming CSS strings with this format will not cause any warnings. Additional semi-colons will cause problems. Note that only one semi-colon is needed.
 +
 +
Please note that the selectors have changed for GTK3.20+, so using things like <code>GtkWidget</code> as a selector will not work. Thankfully, GTK3 CSS is now part of the API, so you can look up the proper selectors [https://developer.gnome.org/gtk3/stable/chap-css-overview.html here].

Latest revision as of 14:05, 22 August 2018

Avoiding CSS warnings in console

GTK CSS has a specific format in order to be parsed without warnings. The format is as follows:

 <widget name/selector> {<property>: <value>;}

For example:

GtkWidget {background-color: rgba(255, 0, 0, 255);}

Forming CSS strings with this format will not cause any warnings. Additional semi-colons will cause problems. Note that only one semi-colon is needed.

Please note that the selectors have changed for GTK3.20+, so using things like GtkWidget as a selector will not work. Thankfully, GTK3 CSS is now part of the API, so you can look up the proper selectors here.

Back to the top