css浮层:footer位置保持在底部

2019-03-1010:01:57网页制作Comments2,599 views字数 575阅读模式

css浮层:footer位置保持在底部文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9889.html

代码如下:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9889.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
<meta name="keywords" content="http://www.baiduyo.com"/>
<meta name="description" content="http://www.baiduyo.com" />
<title>如何让footer位置保持在底部</title>
</head>
<style>
html, 
body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
background:#ccc;
} 
#container { 
    min-height: 100%; 
    height: auto !important; 
    height: 100%; 
} 
#footer { 
    position: relative; 
    margin-top: -150px;/*等于footer的高度*/ 
    height: 150px; 
    clear:both; 
    background: #06f; 
font-size:50px;
font-weight:bold;
text-align:center;
} 
</style>
<body>

 
<div id="container"> 
    <!--这里面添加其他布局-->
</div> 

<div id="footer">footer</div> 


</body>
</html>
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9889.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/zhizuo/9889.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定