Facebook 标签页内的图像翻转
我正在尝试在 Facebook 选项卡页面内使用简单的 CSS 精灵进行基于图像的翻转,并且背景图像被 Facebook 剥离。需要明确的是,此问题仅发生在 Tab 页面内,而不是在主应用程序本身中。
Facebook 在删除背景图像时似乎也非常挑剔 - 应用于锚标记的背景图像被删除,但应用于包含锚的列表元素的背景图像保持不变。
例如,给定标记:
<li><a href="http://some/destination.html" target="_top"><img src="http://absolute/path/to/spacer-image.png" alt="" width="172" height="43" /></a></li>
以下 CSS 将成功地将背景应用于列表元素:
li {
background: url(http://absolute/path/to/some/image.jpg) no-repeat 0 0;
}
但应用于子锚标记的相同 CSS 被 Facebook 删除:
li a {
background: url(http://absolute/path/to/some/image.jpg) no-repeat 0 0;
}
Facebook 实际上能够支持选项卡内基于图像的翻转,如果是这样,怎么办?
I'm trying to use a simple CSS-sprite for image-based rollovers inside a Facebook Tab page, and the background images are being stripped by Facebook. To be clear, this problem only occurs inside a Tab page, but not in the main application itself.
Facebook also appears to be extremely picky about when it strips background images - background images applied to anchor tags are removed, but background images applied to the list element containing the anchor remain intact.
For example, given the markup:
<li><a href="http://some/destination.html" target="_top"><img src="http://absolute/path/to/spacer-image.png" alt="" width="172" height="43" /></a></li>
the following CSS will apply a background to the list element successfully:
li {
background: url(http://absolute/path/to/some/image.jpg) no-repeat 0 0;
}
but the same CSS applied to the child anchor tag is stripped out by Facebook:
li a {
background: url(http://absolute/path/to/some/image.jpg) no-repeat 0 0;
}
Is Facebook actually capable of supporting image-based rollovers inside a tab, and if so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过反复试验发现了一种解决方案,尽管它涉及无效堆叠的 html 并且看起来非常令人讨厌。
修改标记,使 div 位于锚标记内:
并将背景图像应用到 div 而不是锚:
然后您可以像这样应用背景偏移
:确实有效,但如果有人能提出建议,我宁愿选择一个不那么麻烦的解决方案。
Discovered a solution of sorts through trial and error, though it involves invalidly stacked html and looks pretty nasty.
Modify the markup so a div is inside the anchor tag:
and apply the background image to the div instead of the anchor:
You can then apply the background offset like this:
It does work but I'd much rather a less-hacky solution if anyone can suggest something.