我的动画
div=document.createElement("div");
div.setAttribute("style","width:100px; height:100px; background-image:url(幻片灯.gif); border:red 1px groove; ");
document.body.appendChild(div);
回复讨论(解决方案)
你的图片路径有问题吧?下面的例子是可以的,考虑浏览器兼容性,还是规范写比较好
div=document.createElement("div"); div.style.width="100px"; div.style.height="100px"; div.style.backgroundImage="url('http://avatar.csdn.net/D/B/7/1_csdn1843321653.jpg')"; div.style.border="red 1px groove"; document.body.appendChild(div);
查看更多关于求大神赐教,为什么我的图片背景background-image设置没有效果_html/css_WEB的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did114207