CSS 全屏布局使用float和over-flow

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>全屏布局</title>
		<!-- 特点:1.滚动条不是全局滚动条,而是出现在内容区域,往往是主内容区域 2.浏览器变大时,撑满窗口 -->
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}
			html,body{
				width: 100%;
				height: 100%;
			}
			.parent{
				height: 100%;
				width: 100%;
			}
			.top{
				background-color: red;
				height: 10%;
			}
			.left{
				float: left;
				width: 10%;
				height: 80%;
				background-color: yellow;
			}
			.right{
				background-color: green;
				height: 80%;
				overflow: auto;
			}
			.bottom{
				position: absolute;
				bottom: 0px;
				width: 100%;
				height: 10%;
				background-color: antiquewhite;
			}
		</style>
	</head>
	<body>
		<div class="parent">
			<div class="top">
				我是顶部
			</div>
			<div class="left">
				我是左侧
			</div>
			<div class="right">
				我是右侧
				<div style="height: 1000px;width: 100%;background-color: aqua;"></div>
			</div>
			<div class="bottom">
				我是底部
			</div>
		</div>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/xvzhengyang/article/details/84593285