简体   繁体   中英

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:

$('#object').css('background-image', 'url(../../Content/Images/green-tick.png');

It works in all browsers expect from 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)

I cant debug the browser as I am only testing this with an iPad.

Thanks for your help.

Check the height that you have allocated.
I had a scenario with height: 100%. That didn't work in 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM