css - gwt按钮的自定义CSS样式

标签 css gwt button

我有以下代码

Button orderButton = new Button("");
orderButton.setStyleName("OrderButton");
orderButton.getElement().getStyle().setProperty("marginTop", "35px");

CSS 看起来像这样

.OrderButton { 
      width:208px;
      height:43px; 
      background-image:url('graphics/OrderButton.jpg');border:0;margin:auto; 
}

.OrderButton-down { 
      width:208px;
      height:43px; 
      background-image:url('graphics/OrderButton_down.jpg');border:0;margin:auto; 
}

但是点击按钮并没有改变任何东西。样式保持不变,“OrderButton”和“OrderButton-down”被忽略。

我是不是忘记了什么?

最佳答案

您是否尝试过使用常用的 css 标签 active 和 hover?

".OrderButton-down" would then look like this ".OrderButton:active" This way you can also use the :hover tag

关于css - gwt按钮的自定义CSS样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9650016/

相关文章:

css - 为什么网格系统将最后一列向右浮动

css - 如何确保我的布局适合每个屏幕分辨率

html - Prestashop 为特定类别创建自定义布局

带参数的 Python Matplotlib 回调函数

html - 如何使用 UL 制作水平站点地图?

java - 带有 HTMLPanel 和 addAndReplaceElement 方法的 GWT NoSuchElementException

java - 在 GXt 2.2.3 的 EditorGrid 中,列标题下的行未正确对齐

css - GWT 主题样式覆盖了我的 css 样式

c# - 什么按钮按下输入框 C#

html - 按钮标签内对象标签的大小