我试图让我的页脚直接出现在我页面上的最后一个 div 之后,但我无法弄清楚它为什么低于我想要的位置。任何人都可以帮忙吗?继承人的代码:
<div id="container">
<div id="header">
<h1>
<!--<a href="#"><img src="tracylogo7.jpg" alt="Millington and Hope" /></a> -->
<a href="#"><img src="tracylogo6header.jpg" alt="Millington and Hope" /></a>
</h1>
<h2>
<!--<a href="#"><img src="tracylogo5_header.jpg" alt="Millington and Hope" /></a> -->
</h2>
</div>
<ul id="nav">
<li><a href="index.html">Home</a></li><!--
--><li><a href="stock.html">Stock</a></li><!--
--><li><a href="events.html">Events</a></li><!--
--><li><a href="contact.html">Contact</a></li>
</ul>
<div id="box">
<a href="#"><img src="home4.jpg" alt="Slideshow Image 1" /></a>
<a href="#"><img src="home6.jpg" alt="Slideshow Image 2" /></a>
<a href="#"><img src="home4.jpg" alt="Slideshow Image 3" /></a>
</div>
<div id="box2">
<a href="#"><img src="tracylogosmall.jpg" alt="Logo" /></a>
</div>
<div id="footer">
<p class="client">Tel: 0785740 E-mail: tjdelape@hotmail.co.uk</p>
</div>
</div>
html,body
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
body
{
background:rgb(171,163,144);
text-align: center;
min-width: 600px;
}
#container
{
margin:0 auto;
background:rgb(171, 163, 144);
width:80%;
}
#nav
{
border:1px solid #ccc;
border-width:1px 0;
list-style:none;
margin:0;
padding:0;
text-align:center;
/*background:rgb(161,153,134) /* for non-css3 browsers */
background: -webkit-radial-gradient(circle, rgb(151,143,124),rgb(171, 163, 144));
background: -moz-radial-gradient(circle, rgb(151,143,124),rgb(171, 163, 144));
}
#nav li
{
display:inline;
}
#nav a
{
display:inline-block;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
padding:10px 20px 10px 20px;
text-decoration:none;
color:white;
}
#nav a:hover
{
background:rgb(171, 163, 144);
}
#header
{
padding: 0px;
color: white;
width:100%;
text-align:center;
}
#header h1
{
margin: 0;
}
#stock
{
position:relative;
margin:0 auto;
margin-top:35px;
width: 1000px;
border-collapse:collapse;
}
#stock th
{
height: 30px;
background:rgb(151,143,124);
}
table, td, th
{
color:white;
border: solid 1px black;
padding: 2px;
}
#events
{
position:relative;
margin:0 auto;
margin-top:35px;
width: 1000px;
border-collapse:collapse;
}
#events th
{
height: 30px;
background:rgb(151,143,124);
}
#footer {
position:fixed;
left:0px;
bottom:0px;
height:25px;
width:100%;
background:rgb(151,143,124);
border-top:solid 1px white;
}
.client
{
color:white;
margin:3px auto;
text-indent:1cm;
text-align:left;
}
#sold
{
color: red;
}
#box
{
position:relative;
margin:0 auto;
width:100%;
height:200px;
margin-top:100px;
}
#box img
{
margin:0 auto;
border:solid 1px white;
margin: 10px;
}
#box2
{
position:relative;
margin-top:200px;
width: 100%;
}
#box2 img
{
margin:0 auto;
opacity:0.5;
filter:alpha(opacity=50);
}
h3
{
color:white;
text-decoration:underline;
}
#container2 {
clear:left;
float:left;
width:100%;
overflow:hidden;
background:rgb(171,163,144); /* column 2 background colour */
}
#container1 {
float:left;
width:100%;
position:relative;
right:50%;
background:rgb(171,163,144); /* column 1 background colour */
}
#left {
float:left;
width:46%;
position:relative;
left:52%;
text-align:left;
overflow:hidden;
}
#right{
float:left;
text-align:left;
width:46%;
position:relative;
left:56%;
overflow:hidden;
}
p
{
color:white;
}
在我最后一个 div 之后,页脚似乎有很大的余量,但我认为这不是我声明的?