超强-1个div固定铺满全屏

我们现在要实现1个div
铺满当前界面全部

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>超强-上下两个div上面值固定下面铺满高度</title>
	<style type="text/css">
	 
		* {
    
    
			margin: 0;
			padding: 0;
		}

		.parentDiv {
    
    
			width: 100%;
			height: 100%; 
			position: absolute;
			display: flex;
			flex-direction: column; 
		} 
		/*.childDiv1 {
    
    
			background-color: blue;
			width: 100%;
			height: 200px;
		}*/

		.childDiv2 {
    
    
			background-color: red;
			width: 100%;
			flex: 1;
		}
	</style>
</head>

<body>
	<div class="parentDiv">
		<!-- <div class="childDiv1">1111</div> -->
		<div class="childDiv2">
	 2222 
		</div>
	</div>
</body>

</html>

猜你喜欢

转载自blog.csdn.net/milijiangjun/article/details/108442922