我目前正在一个网站上工作,而且我对这个页脚不会停留在页面底部感到很生气。我已经检查了同样问题的其他主题,但没有解决我的问题。无法在页面底部设置页脚
当我尝试“相对”时,页脚在“topbox”(这是我的页眉)下面,而当我尝试“绝对”时,它会在页面中间。
<header>
<div class="topbox">
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">Services</a></li>
<li><a href="#contact">Clients</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</div>
</header>
<body>
<div class="wrapper">
<div class="scrollbtn"><img src="Images/Scroll.png" style="width:40%"/>
</div>
<div class="bgbox">
<div class="box2">
<a> Lorem ipsum dolor sit amet, consectetur adipiscing elit...
</a>
</div>
</div>
<div id="footer">© 2017 "TEXT" All Rights Reserved</div>
</div>
</body>
所以在这里我们有顶盒这是标题,包装,scrollbtn(鼠标的PIC指示需要滚动),bgbox(内容的背景),BOX2(内容)中,“lorep存有“是用户滚动的内容并且非常长。这是我的问题,当您向下滚动页面时,页脚处于页面底部,因此处于页面中间。
这里是CSS:
body, html {
width:100%;
height:100%;
background-color: #060b0f;
padding:0%;
background-image: url('../images/background3.jpg');
background-size:cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
/* HEADER */
.topbox {
margin:0%;
position: fixed;
top:0%;
left: 0%;
width:100%;
z-index:999;
text-align:center;
overflow: hidden;
padding:0%;
font-family:Impact;
font-size:20px;
}
.topbox ul {
list-style-type: none;
margin: 0%;
padding: 0%;
overflow: hidden;
background-color: #459cfe;}
.topbox li {
display: inline;
}
.topbox li a {
display: inline;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.topbox li a:hover:not(.active) {
background-color: #397fcd;
}
.active {
background-color: #fff;
}
/*HEADER FIN*/
.scrollbtn {
position: absolute;
bottom : 0%;
left: 49%;
}
.hot {
color:#4080e1;
}
.box2 {
margin-top:0px;
margin-left:10%;
width : 70%;
opacity:1;
color: black;
overflow: hidden;
text-align:center;
z-index:4;
background-color:transparent;
}
.box2 a{
opacity:1;
}
.bgbox {
margin-top:0px;
margin-left:8%;
padding: 5%;
padding-left: 8%;
width : 70%;
position: absolute;
top : 10%;
left: 0%;
background-color: rgba(255,255,255,0.5);
overflow: hidden;
text-align:center;
z-index:3;
}
.bgbox:hover {
background-color: rgba(255,255,255,0.9);
}
#footer {
font-size:20px;
cursor:pointer;
color: black;
text-align: center;
width:100%;
position:relative;
left:0px;
bottom:0px;
background-color: #459cfe;
}
.wrapper {
height:100%;
}
我已经尝试了很多不同的东西(改变车身高度,包一切,相对的,绝对的,固定的,静态的,...),我想不出其他的东西。我需要一个外部观点。
'topbox'必须位于body标签内。我不是说这是一个修复,但只是指出这个问题,还是它的错字 –
不,这不是一个错字,但它似乎并没有问题,谢谢 –