[英]CSS Background-Image issue with safari
I have seen these questions dotted around the web with little response. 我看到这些问题点缀在网上,反应却很少。
I add some CSS in jQuery like: 我在jQuery中添加了一些CSS,例如:
$('#object').css('background-image', 'url(../../Content/Images/green-tick.png');
It works in all browsers expect from Safari. 它适用于Safari期望的所有浏览器。
Anyone know as of why? 有人知道为什么吗? Most answers I have seen to this question say to actually use
我对这个问题看到的大多数答案都说是实际使用的
'background-image'
'背景图'
(This answers or 'guides' are mostly not on stackoverflow) (此答案或“指南”大多不在stackoverflow上)
I cant debug the browser as I am only testing this with an iPad. 我无法调试浏览器,因为我仅使用iPad进行测试。
Thanks for your help. 谢谢你的帮助。
Check the height that you have allocated. 检查您分配的高度。
I had a scenario with height: 100%. 我有一个高度为100%的场景。 That didn't work in Safari.
这在Safari中不起作用。 It wanted the height applied in pixels else the height got set to 0 and hence the image appeared not to be shown (although it was there. It just had a height of zero)
它希望以像素为单位应用高度,否则将高度设置为0,因此图像似乎无法显示(尽管它在那里。高度仅为零)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.