button 垂直、水平居中

<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>

【Java面试题与答案】整理推荐

发布了547 篇原创文章 · 获赞 1518 · 访问量 162万+

猜你喜欢

转载自blog.csdn.net/meism5/article/details/105284656
今日推荐