首页 > Web开发 > 详细

CssFooter布局

时间:2020-02-16 20:32:04      阅读:64      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			html,body{
				height: 100%
			}
			.wrap{
				min-height: 100%;
				background: #ffc;
				text-align: center;
				/*开启BFC避免子元素浮动和footer重叠*/
				overflow: hidden;
				
			}
			.wrap .main{
				padding-bottom: 50px;
			}
			.footer{
				height: 50px;
				line-height: 50px;
				background: #096;
				text-align: center;
				margin-top: -50px;
			}
		</style>
	</head>
	<!--
		什么是stickFooter?
		经典的"粘连" footer布局
			我们有一块内容<main></main>
			当main的高度足够长的时候,<footer></footer>应该紧跟在<main></main>元素的后面
			当<main></main>元素比较短的时候(比如小于屏幕的高度),我们期望这个<footer></footer>元素能够"粘连"在屏幕的底部
	-->
	<body>
		<div class="wrap">
			<div class="main">
				<p>main</p>
				<p>main</p>
				<p>main</p>
				<p>main</p>
				<p>main</p>
				<p>main</p>
				<p>main</p>
				<p>main</p>
			</div>
		</div>
		<div class="footer">
			footer
		</div>
	</body>
</html>

  

CssFooter布局

原文:https://www.cnblogs.com/yitiansanchangyu/p/12317992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!