button 垂直、水平居中

2020-04-02  

<html>
<head>
<style>
#div1 {
	width:100px;
	height:100px;
	border:1px black solid;
	
	text-align: center;
}
#div2 {
	width:100px;
	height:100px;
	border:1px black solid;
			
	display:flex;
	align-items:center;
	/* 水平居中把这个打开 */
	/* justify-content:center; */
}
</style>
</head>
<body>
<div id="div1">
<button>水平居中</button>
</div>
<div id="div2">
<button>垂直居中</button>
</div>
</body>
</html>

 

ConstXiong 备案号:苏ICP备16009629号-3