我已经搜索过但似乎无法找到我正在寻找的答案。
我想知道如何将我的 div 向下移动到我的固定标题下方。
@import url(http://fonts.googleapis.com/css?family=Oswald);
body {
width: 100%;
margin: auto;
}
.container {
width: 75%;
margin: 0 auto;
}
.header {
background: #6396bc;
width: 100%;
top: 0;
position: fixed;
}
.logo {
float: left;
font-family: "Oswald", sans-serif;
font-size: 15px;
margin-left: 15%
}
a {
text-decoration: none;
color: white;
}
li {
list-style: none;
float: left;
margin-left: 15px;
padding-top: 15px;
font-family: "Oswald", sans-serif
}
.nav {
float: right;
margin-right: 15%
}
<!DOCTYPE html>
<html>
<head>
<title>team Zeus | Home</title>
<link rel="stylesheet" href="../stylesheets/styles.css">
</head>
<body>
<div class="header">
<div class="container">
<div class="logo">
<h1><a href="#">team Zeus</a></h1>
</div>
<div class="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Page</a></li>
<li><a href="#">Another page</a></li>
<li><a href="#">1 other page</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="content">
<p>I copied and pasted some article from Wikipedia in here, you could do that too (to test out the header at the top)</p>
</div>
</body>
</html>
我认为这与容器有关,因为当我尝试使用宽度调整它们的大小时,它只会弄乱整个页面。我想不通
谢谢
最佳答案
您的意思是将内容向下移动到标题下方?如果这就是您想要的,只需像这样定位内容 div:
.div {
position:relative;
top: 100px;
}
关于html - 将 div 向下移动到固定标题下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29870132/