【问题标题】:Using images as Background image which are defined in client bundle使用客户端包中定义的图像作为背景图像
【发布时间】:2012-10-30 01:38:25
【问题描述】:

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

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;

}

但是图片没有显示。我应该改变什么??

问题出在哪里..?

谢谢

凯瑟尔

【问题讨论】:

    标签: css image gwt background clientbundle


    【解决方案1】:

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

    @sprite .gwt-Button {
       ...
       gwt-image:'hBorder';
       border: 1px outset #ccc;
       ...
    }
    

    用于显示图像,但请注意,这也会将小部件的大小调整为图像的大小。

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      相关资源
      最近更新 更多