css - GWT 图像 Sprite : how to move the background image to the right side

标签 css gwt css-sprites cssresource clientbundle

我想在 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/

相关文章:

CSS Sprite 不适用于 Chrome 移动版

html - 为什么我的网格行/网格项在其中没有内容时被隐藏了?

css - 如何使用 flex-grow 或 flex-shrink (行和列)保留图像?

jquery - 从父元素中删除类

html - 如何为不同大小的图标重用 css 背景 Sprite ?

css - 使用css Sprite 技术时如何减少 Sprite 的数量

css - Flexdashboard - 主题和 CSS

java - 按 T​​ab 键时,重点不要转到 GXT EditorGrid 中的下一个字段

java - 是否可以在 GWT i18n 中重载消息方法

java - GWT 将 div 添加到面板中