Html – toggle button pressed color

cssgwthtml

i am using toggle buttons in my application, i would like to set the backgound-color when the button is pressed.

how can i know what is the proper attribute?

and in general is there any place that i can know which CSS attribute has which effect on the HTML element?

Best Answer

If you are using GWT ToggleButton, then you may

import com.google.gwt.user.client.ui.ToggleButton;
final ToggleButton tb = new ToggleButton( "my button text" );
if (tb.isDown()) {
   tb.addStyleName("pressed"); // or tb.setStyleName("pressed");
}

and in your css file:

.pressed { background-color: blue;  } /* any color you want */

Another way - to change just background of this given button:

tb.getElement().getStyle().setProperty("background", "green");