开发者

Background images defined using "style" attributes not showing in IE

开发者 https://www.devze.com 2023-02-03 22:24 出处:网络
In my website i wanted to provide \'copy protection\' for images by defining them as backgrounds. Its working perfectly on Chrome, Safari and FF. But on IE the background images are not showing. You c

In my website i wanted to provide 'copy protection' for images by defining them as backgrounds. Its working perfectly on Chrome, Safari and FF. But on IE the background images are not showing. You can check out the site www.kettik.com.

The approach i followed was something like this. Since the images are from the DB, i cannot define the background properties inside the css class and have to use the 'style' attribute to define it.

 <div class="contentItemCover" style="clear:both;">
     <img src="/images/sitegfx/spacer.gif", style = "backgrou开发者_开发百科nd: url('xyz') no-repeat;">
 </div>

.contentItemCover img {
   width: 600px;
   height: 290px;
   padding: 0px !important;
 }

Is there any way to work around this issue in IE ? Any help on this would be highly appreciated.


<img src="/images/sitegfx/spacer.gif", style = "background: url('xyz') no-repeat;">

Have you tried removing that comma?


I would just like to say that this "method" of protecting images has a few flaws. You could easily right-click it and say "save background image..." (in IE) and in FF you can "view background image" and then save it anyway. or, you could simply screenshot it. I would advise watermarking images.

0

精彩评论

暂无评论...
验证码 换一张
取 消