[英]Background-image not showing up
由於某種原因,當我嘗試顯示雲圖像(與山圖像完全一樣)時,它沒有顯示! 怎么會? 這兩個圖像都是.png文件。 但是,樹圖像具有純色背景(不透明),而雲具有透明背景。 這是引起問題的原因嗎? 如果是這樣,我該如何解決?
html
{
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #FFFFFF), color-stop(1, #00A3EF));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #00A3EF 100%);
}
.sky {
background: url(clouds2.png) repeat-x;
display: block;
width: 500px;
height: 500px;
border: 1px solid red;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml11/DTD/xhtml11-strict.dtd">
<!-- START HTML -->
<html>
<!-- START HEAD -->
<head>
<!-- Adding title, meta, link to css and scripts to javascript files -->
<title>27 Days</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="css/27.css" />
<!-- END HEAD -->
</head>
<!-- START BODY -->
<body>
<!-- Creating div to encompass our entire piano -->
<div class="sky" id="sky">
<div class="clouds1" id="clouds1"></div>
<div class="clouds2" id="clouds2"></div>
</div>
<!-- END BODY -->
</body>
<!-- END HTML -->
</html>
據我所知,您必須將顏色指定為background
的第一個參數,並將圖像放在單引號中:
background: transparent url('clouds2.png') repeat-x;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.