CSS 布局垂直居中:使用flex和align

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>垂直居中:使用flex和align</title>
		<style type="text/css">
			.parent{
				display: flex;
				flex-direction: column;
				justify-content: center;
				background-color: red;
				height: 100px;
			}
			.son{
				background-color: #00FFFF;
			}
		</style>
	</head>
	<body>
		<div class="parent">
			<div class="son">
				测试垂直居中
			</div>
		</div>
	</body>
</html>

猜你喜欢

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