两个块状元素并排居中显示的代码?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>浮动模型</title>
<style type="text/css">
.div{
width:300px;
height:150px;
margin:auto;
}
.div .div1{
border:2px red solid;
width:100px;
height:100px;
float:left;
}
</style>
</head>
<body>
<div class="div">
<div class="div1"></div>
<div class="div1"></div>
</div>
</body>
</html>
你说的是垂直居中吧,两个元素都加上这个
{display:inline-block;
vertical-align:middle;}