我也有一个背景图像,我想让标题在整个屏幕上伸展,并将导航栏实现到标题中(我已经解决了标题中的导航栏问题)。我也搜索并尝试了这里的所有示例,但均无济于事。例如像这样: http: //www.projectseven.com/
我的html代码是这样的:
<!DOCtype html>
<html>
<head>
<title>Adventist Youth's Empowerment</title>
<link rel="stylesheet" href="mainstyle.css" text="style/css">
<head>
<div id="header">
<nav>
<nav id="nav_bar_center">
<ul>
<li><a href="Home.html">Home</a></li>
<li><a href="Main.html">Main</a></li>
<li><a href="Aboutus.html">About Us</a></li>
<li><a href="Contactus.html">Contact US</a></li>
<li><a href="form.html">Form</a></li>
<li><a href="Pictures.html">Pictures</a></li>
</ul>
</nav>
</nav>
</div>
</head>
我的CSS代码是这样的:
body {
background-repeat:
background-size: 100%;
background-image: url(Images/background%20image5.jpg);
background-position: fixed;
}
#content {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 18px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: small-caps;
text-transform: none;
color: #000000;
}
nav {
width: 100%;
height: 33px;
background-image:url(Images/navbar.gif);
background-repeat:repeat;
}
#nav_bar_center {
width: 900px;
margin-left:auto;
margin-right:auto;
}
nav ul{
list-style:none;
}
nav a {
display:inline;
float:left;
text-decoration:none;
color:#FFF;
font:"Times New Roman", Times, serif;
font-size:18px;
font-weight:bold;
line-height: 33px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 5px;
}
nav a:hover {
background-image:url(Images/navbgr.gif);
height: 28px;
}
#header {
width: 100%;
background-image:url(Images/header.gif);
}