出于某种原因,当我尝试显示云图像(我的图像与山图像完全相同)时,它不会显示出来!怎么会?两个图像都是.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>
答案 0 :(得分:1)
据我所知,您必须指定一种颜色作为background
的第一个参数,并将图像放在单引号中:
background: transparent url('clouds2.png') repeat-x;