html - 为什么我的背景图片不显示?

标签 html css image header

我的标题图片无法显示的原因是什么? (对 future 的任何建议将不胜感激!)


下面您将看到我当前的语法。 我想添加一个 jsfiddle 链接,但由于所有内容都是我计算机上的图像,所以我认为上传整个文件夹会更容易。 HERE是那个的链接


html

<head>
    <title>index</title>
    <link href="style.css"  rel="stylesheet"  type="text/css" />
</head>
<body>
    <div id="container">    
        <div id="header"></div><!-- end header -->

        <div id="menu">
            <ul>
                <li><a href="index.php"><img border="0" id="homebutton" alt="" src="img/home button.png" width="145px" height="auto"></a></li>
                <li><a href="about.php"><img border="0" id="aboutbutton" alt="" src="img/about button.png" width="145px" height="auto"></a></li>
                <li><a href="gallery.php"><img border="0" id="gallerybutton" alt="" src="img/gallery button.png" width="145px" height="auto"></a></li>
                <li><a href="contact.php"><img border="0" id="contactbutton" alt="" src="img/contact button.png" width="145px" height="auto"></a></li>
            </ul>
        </div><!-- end menu -->

        <div id="content"></div><!-- einde content -->      
    </div><!-- end container -->    
</body>

CSS

#container {
    margin: 0px auto;
    padding: 10px;
    width: 1300px;
}

#header {
    background-image: url("img/header.png");
    background-repeat: no-repeat;
    width: 1300px;
    height: auto;
    max-height: 275px;
}

#menu ul {
    margin: 0;
    padding: 0;
    list-style:none;
}

#menu ul li  {
    float: left;
}

最佳答案

尝试将 max-height: 275px; 更改为 min-height:275px;

div 没有内容所以默认为 0px

关于html - 为什么我的背景图片不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28454318/

相关文章:

html - Bootstrap HTML 选择下拉选项在 IE 7 与 IE8 中不对齐

php - 点击按钮后,保存到MySQL然后显示CSS高亮

html - IE 中的 CSS 问题

javascript - 使用 Flask 和静态路径链接 .js 文件

html - 我将网站发送到 Linux 服务器后,有些图片未显示

javascript - 如何重写 jQuery 验证两次?

html - Google Calendar API-403错误

jquery - 从 <select> 选项到 span CSS 类的值

javascript - 如何运行窗口调整大小功能?

javascript - 使用 React 在同一签名 URL 处使用新图像刷新图像