How to apply CSS for buttons in sidebar

please refer to the following code

#include <gtk/gtk.h>

static void activate( GtkApplication *app, gpointer user_data )
	GtkWidget *window = gtk_application_window_new( app );
	GtkWidget *stk_switcher = gtk_stack_switcher_new();
	GtkWidget *stack = gtk_stack_new();
	GtkWidget *box = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 );
	gtk_window_set_child( (GtkWindow*)window, box );
	gtk_stack_switcher_set_stack( (GtkStackSwitcher*)stk_switcher, (GtkStack*)stack );
	gtk_stack_add_titled( (GtkStack*)stack, gtk_check_button_new_with_label( "Check Button 1" ), "StackPage1", "page1" );
	gtk_stack_add_titled( (GtkStack*)stack, gtk_check_button_new_with_label( "Check Button 2" ), "StackPage2", "page2" );
	GtkWidget *side_bar = gtk_stack_sidebar_new();
	gtk_stack_sidebar_set_stack( (GtkStackSidebar*)side_bar, (GtkStack*)stack );
	gtk_box_append( (GtkBox*)box, side_bar );
	gtk_box_append( (GtkBox*)box, stack );
	gtk_stack_set_transition_type( (GtkStack*)stack, GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT_RIGHT );
	gtk_stack_set_transition_duration( (GtkStack*)stack, 1000 );
	gtk_widget_show( window );

int main( int argc, char **argv )
	GtkApplication *app = gtk_application_new( "", G_APPLICATION_FLAGS_NONE );
	g_signal_connect( app, "activate", G_CALLBACK( activate ), NULL );
	int status = g_application_run( G_APPLICATION( app ), argc, argv );
	g_object_unref( app );

	return status;

is there a way to apply CSS to page1 and page2 buttons in the GtkStackSidebar

Have you tried reading the documentation for GtkStackSidebar, to find the CSS selectors that apply to it?

You haven’t specified which major version of GTK you’re using (not the first time, either) so I’m just going to link you to the API reference of:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.