我想在 GWT 客户端包中使用以下样式:
.myClass tr:hover {<br/>
background: url("myImage.png") 185px 2px no-repeat;<br/>
}
我声明的图像如下:
@Source("resources/myImage.png")<br/>
@ImageOptions(repeatStyle = RepeatStyle.None)<br/>
ImageResource myImage();
并将样式更改为:
@sprite .myClass tr:hover {<br/>
gwt-image: "myImage";<br/>
background-position: 185px 2px;<br/>
}
但它不起作用。生成的 XYZ.cache.png 中有几张图片。因此,如果我在 Firebug 中更改背景位置,我会看到完整的图像包。
如何将背景图片移动到正确的位置?
最佳答案
@sprite .myClass tr:hover {
gwt-image: "myImage";
}
div.myClass tr:hover{
background-position: 185px 2px;
}
正如您所注意到的,gwt-image 将默认删除“background-position”以及其他一些。要覆盖 0 0
的默认位置,请使用您想要的位置添加更具体的 css 规则。
关于css - GWT 图像 Sprite : how to move the background image to the right side,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6108028/