[英]Can change background with background-color, but not background-image
由於某種原因,我無法改變自己的背景。 如果我使用background-color: #000
,它將改變,但如果我使用background-image: url();
則不會改變background-image: url();
不起作用。
到目前為止,這是我嘗試過的兩種方法:
document.body.style.background="url('CloudWallpaper.jpg') no-repeat right top";
background-image: url(CloudWallpaper.jpg);
這些都不起作用。 關於為什么或可能會干擾它的任何想法?
嘗試這個
document.body.style.backgroundImage="url('CloudWallpaper.jpg')";
http://www.w3schools.com/jsref/prop_style_backgroundimage.asp
嘗試這個:
<html>
<body style="background-image:url('image.jpg')">
</body>
</html>
嘗試使用html進行背景更改
<html>
<body background="background.jpg">
</body>
</html>
或鏈接
<html>
<body background="http://www.cooness/coolimage.jpg">
</body>
</html>
您的.css
文件位於文件夾中嗎? 然后嘗試使用background-image: url("../CloudWallpaper.jpg");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.