我做了这个:jsfiddle Demo
我有这条线:
<div id="footer">
<h1><a class="link" href="http://www.centerwow.com">mysite</a></h1>
</div>
如何将链接mysite居中在div footer
中心。宽度和高度应该在 about(menu) 下面。我尝试将位置设置为绝对和相对,并以某种方式破坏了其他东西。谢谢你的帮助。
我的代码:
body {
background: #CC3366 url(images/temp.png) center 130px no-repeat ;
overflow:hidden;
font-family: Arial;
font-size: 30px;
line-height: 32px;
}
#container {
width: 1000px;
overflow: hidden;
position: relative;
height: 450px;
margin: 0 auto;
}
#all_pages {
position: absolute;
left: 0;
top: 0;
width: 3000px;
}
.page {
width: 1000px;
height: 400px;
float: left;
text-align: center;
margin-top: 50px;
}
.page img {
margin-top: 50px;
}
#menu {
background: #000;
}
#menu ul {
list-style: none;
width: 457px;
height: 35px;
margin:auto;
}
#menu ul li {
float: left;
color: #888;
width: 150px;
line-height: 35px;
text-align: center;
cursor: pointer;
}
.active {
color: #fff !important;
}
h1 a {
color: #000000;
text-decoration: none;
}
#footer a{
position:absolute;
bottom:80px;
margin: 0 auto;
}
#footer{
position:relative;
background: #CC3366;
width:100%;
height:1000px;
}
<h1><a class="link" style="position:absolute; left:30px; top:30px;" href="http://www.centerwow.com">portfolio</a></h1>
<div id="container">
<div id="all_pages">
<div class="page">
<h1>Home Page</h1>
<img src="images/home.png" width="300">
</div> <!-- page1 -->
<div class="page">
<h1>About Us Page</h1>
<img src="images/about.png" width="300">
</div> <!-- page2 -->
<div class="page">
<h1>Contact Us Page</h1>
<img src="images/contact.png" width="300">
</div> <!-- page2 -->
</div> <!-- #all_pages -->
</div> <!-- #container -->
<div id="menu">
<ul>
<li id="1" class="link CC3366 active">Home</li>
<li id="2" class="link 33FF66">About</li>
<li id="3" class="link FFFF33">Contact Us</li>
</ul>
</div> <!-- #menu -->
<div id="footer">
<h1><a class="link" href="http://www.centerwow.com">mysite</a></h1>
</div>