Java GWT客户端包!重要的

Java GWT客户端包!重要的,java,gwt,Java,Gwt,如何添加!重要信息至gwt图像在客户端包中gwt: 我有这个: @sprite .superButton{ gwt-image : 'superButton'; background-color: transparent !important; background-repeat: no-repeat !important; background-position-x: 10px; } 我想拥有:gwt image:'超级按钮'!重要的 如何解决我的问题?这是不可能的,因为您的

如何添加
!重要信息
gwt图像
在客户端包中
gwt

我有这个:

@sprite .superButton{
  gwt-image : 'superButton';
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position-x: 10px;
}
我想拥有:
gwt image:'超级按钮'!重要的

如何解决我的问题?

这是不可能的,因为您的
!重要信息
将被GWT编译器忽略

事实上,GWT编译器将替换
GWT映像:'superButton'
(在编译时)如下所示:

.sprite {
  height: 18px; /* width of your img */
  width: 18px; /* height of your img */
  overflow: hidden;
  background: url("data:image/png;base64,iVBORw0KGg...") -0px -0px no-repeat; /* your image data in base64 encoding */
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position-x: 10px;
}
如果要覆盖GWT编译器生成的任何属性,只需在
GWT image
属性之后重新声明要覆盖的属性:

@sprite .superButton {
  gwt-image : 'superButton';
  height: 20px; /* This overrides height:18px; generated by the compiler */
}
定义图像的另一种方法是使用
@url
使用
图像资源

@url superButton superButton;

.superButton {
  background-image: superButton;
}
将汇编为:

.superButton {
  background-image: url("data:image/png;base64,iVBORw0KGg...");
}
更多信息: