怎样让图片垂直居中于网页显示

2020年12月3日 | 分类: 【源码】

参考:https://blog.csdn.net/qq_32623363/article/details/77101971

<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<title>404</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta http-equiv="refresh" content="3;URL=/">
	<style type="text/css">
	.container {
		text-align: center;
		width: 400px;
		height: 249px;
		margin: auto;
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}
	</style>
</head>
<body>
<div class="container">
    <img alt="404" src="/404.jpg" />
</div>
</body>
</html>