我已经尝试以我能想到的所有可能方式显示这样的图像: 1.链接到像现在这样的网站 2. 将图像设为本地:bird.png 3.我总是仔细检查图片的名称和扩展名是否正确 4. ../images/bird.png ETC。 感谢任何帮助
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title> Internal Affairs Inc. | When Information Really Matters </title>
<style>
#logo
{
background-image:url('http://www.birds.com/wp-content/uploads/home/bird4.jpg');
}
</style>
</head>
<h1>ho</h1>
<body>
<div id="logo"></div>
</body>
</html>
最佳答案
div 没有任何尺寸。 0高度。添加一些 302px
的高度,因为图像是 302px 高:
#logo {
background-image:url('http://www.birds.com/wp-content/uploads/home/bird4.jpg');
height: 302px;
}
<div id="logo"></div>
关于html - Css 拒绝显示图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41516915/