GWT客户端捆绑包!重要

伊德米特列耶夫

如何添加!importantgwt-image在客户端包GWT

我有这个 :

@sprite .superButton{
  gwt-image : 'superButton';
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position-x: 10px;
}

我想要:gwt-image : 'superButton' !important;如何解决我的问题?

g

这是不可能的,因为!importantGWT编译器将忽略

实际上,GWT编译器将用以下方式替换您的gwt-image: '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使用ImageResource

@url superButton superButton;

.superButton {
  background-image: superButton;
}

它将被编译为:

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

更多信息:http : //www.gwtproject.org/doc/latest/DevGuideClientBundle.html#References_to_Data_Resources

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章