CSS 多个块状元素的水平居中

2018-01-03 10:59:00
admin
原创
518
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>CSS 多个块状元素的水平居中</title>
	</head>
	<style>
#container{
	height:100px;
	background:#d6d6d6;
	text-align:center;
}

#center{
	display:inline-block;

	width:100px;
	height:100px;
	background-color:#666;
	color:#fff;
	font-weight:bold;
	font-size:18px;
}
	</style>
	<body>
	<div id='container'>
		<div id = 'center'>#center</div>
		<div id = 'center'>#center</div>
		<div id = 'center'>#center</div>
	</div>
		
	</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络