html - Css 拒绝显示图像?

标签 html css

我已经尝试以我能想到的所有可能方式显示这样的图像: 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/

相关文章:

javascript - Beaglebone Black Rev C Debian,从 html 运行 PHP 程序

html - 伪元素中的 "searchable, selectable, and available"是否不一致?

html - 当行宽为 960px 时,如何在 zurb foundation 中使四个图像在单行中显示

html - 表格布局 : have one row get all space required (because of rowspan)

javascript - 在 bootbox 回调中将 border 和 boxShadow 颜色改回正常

html - 如何相对于文本定位图像?

html - 如何将标题放在导航栏的中间?

javascript - 如何将滚动条附加到 div 部分?

html - 最大宽度 : 100% + max-height: 100% doesn't work on iPad

html - 仅从左侧删除阴影