基本上我想要做的是讓我的背景圖像填充頁面,並有我的導航,在我的頁腳頂部,並且都保持在底部。我嘗試了很多不同的東西,我似乎可以正確定位它們。我有一個非常基本的證明我想讓我的網站看起來像但我不能張貼圖片...任何幫助,非常感謝。正確的CSS定位幫助需要
這是我目前的HTML:
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Nathan Langer</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="wrapper=">
<div id="name">
<h1>Nathan Langer</h1>
</div>
<nav>
<ul>
<li><a href="resume.html">Resume<img src="images/resume logo.png"width="35"height="35"><strong></strong></a></li>
<li><a href="portfolio">Portfolio<img src="images/portfolio logo.png" width="45"height="35"><strong></strong></a></li>
<li><a href="aboutme">What I Do<img src="images/camera logo.png" width="75"height="35"></a></li>
</ul>
</nav>
<h3>For professional video and media production</h3>
</div> <!-- close for wrapper -->
</body>
</html>
我的CSS:
body {
background-image: url(images/cool.png);
vertical-align: middle;
background-size:100%;
background-position: fill;
background-repeat: no-repeat;
}
#wrapper {
width: auto;
height: auto;
margin-left: auto;
margin-right: auto;
}
#name {
text-align: center;
font-size: 35px;
color: white;
font-family: Herculanum, "Eras Demi ITC", sans-serif;
}
nav{
position: relative;
bottom: -550px;
left: 250px;
}
nav ul {
list-style: none;
margin-right: -50px;
}
li {
display: inline;
border: 2px solid rgb(256,256,256);
font-family: Herculanum, "Eras Demi ITC", sans-serif;
font-size:25px;
border-top-left-radius:1em;
border-top-right-radius:1em;
background-color: #A3A3A3;
padding: 10px 20px;
}
nav li a:hover {text-decoration:none ;}
nav li a:visited {color: rgb(256,256,256);}
nav li a:link {text-decoration:none; color: #989898;}
h3 {
text-decoration:none ;
text-align: center;
position: absolute;
background-color: #A3A3A3;
position: relative;
bottom: -550px;
color: white;
}
爲背景大小,使用'cover' https://developer.mozilla.org/en-US/docs/Web/CSS/background-size – Huangism