Css 使用在客户端包中定义的图像作为背景图像

Css 使用在客户端包中定义的图像作为背景图像,css,image,gwt,background,clientbundle,Css,Image,Gwt,Background,Clientbundle,我试图使用一个图像作为按钮的背景。 我将映像定义为客户端包中的资源 public interface MyResources extends ClientBundle { @Source("image/hborder.png") ImageResource hBorder(); } 在css文件中,我尝试使用以下代码引用此图像 .gwt-Button { margin: 0; padding: 3px 5px; text-decoration: none;

我试图使用一个图像作为按钮的背景。 我将映像定义为客户端包中的资源

public interface MyResources extends ClientBundle {
        @Source("image/hborder.png")
        ImageResource hBorder();
}
在css文件中,我尝试使用以下代码引用此图像

.gwt-Button {   
margin: 0;
padding: 3px 5px;
text-decoration: none;
font-size: small;
cursor: pointer;
cursor: hand;   
gwt-image:'hBorder' ;
background: repeat-x 0px -27px;
border: 1px outset #ccc;
}

但是图像没有显示出来。我应该改变什么

问题在哪里

谢谢


kayser

您需要添加:
@sprite
并删除背景:

@sprite .gwt-Button {
   ...
   gwt-image:'hBorder';
   border: 1px outset #ccc;
   ...
}
用于显示图像,但请注意,还可以根据图像大小调整小部件的大小