gpt4 book ai didi

css - 如何将页脚保留在页面底部?

转载 作者:行者123 更新时间:2023-11-28 16:13:20 27 4
gpt4 key购买 nike

我希望我的页脚保留在页面的最底部,而不是屏幕底部或随处可见的粘性页脚,我希望它保留在最后!!

#footer ul {
width: 100%;
height: 30px;
z-index: 10;
position: absolute;
bottom: 0px;
left: 0;
list-style-type: none;
margin: 0;
padding: 0;
font-size: .65em;
border-top: 1px solid rgba(0,0,0,0.4);
}

我的页脚在这个容器里面

#container {
font-family: 'Syncopate', sans-serif;
width: 100%;
height: auto;
height: 100%;
min-height: 100%;
margin: 0 auto;
left: 0;
}

HTML代码

<html>
<head>
<link rel="stylesheet" href="CSS/style.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Syncopate' rel='stylesheet' type='text/css'>
</head>
<body>

<div id="container">
<div id="header">
<span class="icon"><img src="img/safety_icon5.png"></span>
<span class="logo">Dsn de Mexico</span><br>
<span class ="logosub">Seguridad Industrial</span>
<div id="nav">
<ul>
<li><a href="#">Contactenos</a></li>
</ul>
</div>
</div>

<div id="content">
<span class="products_title">Productos</span>
<span class="fill_h">hide</span>
<div class="products_grid"><a href="#"></a>
<h3>Lentes.</h3>
<img src="img/gafas seguridad.jpg" class="image">
<p>
Maecenas aliquet velit vel turpis. Mauris neque metus, malesuada nec, ultricies sit amet, porttitor mattis, enim. In massa libero, interdum nec, interdum vel, blandit sed, nulla. In ullamcorper, est eget tempor cursus, neque mi consectetuer mi, a ultricies massa est sed nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Proin nulla arcu, nonummy luctus, dictum eget, fermentum et, lorem. Nunc porta convallis pede.
</p>
</div>
<div class="products_grid">
<h3>Respiradores.</h3>
<img src="img/respirador.jpg" class="image">
<p>
Maecenas aliquet velit vel turpis. Mauris neque metus, malesuada nec, ultricies sit amet, porttitor mattis, enim. In massa libero, interdum nec, interdum vel, blandit sed, nulla. In ullamcorper, est eget tempor cursus, neque mi consectetuer mi, a ultricies massa est sed nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Proin nulla arcu, nonummy luctus, dictum eget, fermentum et, lorem. Nunc porta convallis pede.
</p>
</div>
<div class="products_grid">
<h3>Guantes.</h3>
<img src="img/guantes.jpg" class="image">
<p id="widget">
Maecenas aliquet velit vel turpis. Mauris neque metus, malesuada nec, ultricies sit amet, porttitor mattis, enim. In massa libero, interdum nec, interdum vel, blandit sed, nulla. In ullamcorper, est eget tempor cursus, neque mi consectetuer mi, a ultricies massa est sed nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Proin nulla arcu, nonummy luctus, dictum eget, fermentum et, lorem. Nunc porta convallis pede.
</p>
</div>

</div>
<div id="extend_content">
<img src="img/proveedores.jpg" alt="Nuestros Proveedores">
</div>

<div id="footer">
<ul>
<li><a href="#">Guantes</a></li>
<li><a href="#">Overoles</a></li>
<li><a href="#">Tapones</a></li>
<li><a href="#">Lentes</a></li>
<li><a href="#">Respiradores</a></li>
<li><a href="#">Miscelaneos</a></li>
<li><a href="#">Cuarto Limpio</a></li>
<li><a href="#">Prod. Aluminizados</a></li>
</ul>
</div>



</div>



</body>
<html>

最佳答案

使用粘性页脚

如图 here

CSS

html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}

关于css - 如何将页脚保留在页面底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16293885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com