我的标题图片无法显示的原因是什么? (对 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/