我有三个要在页面上并排居中的 div。我也有一些内容,例如<p>
和<h3>
标签
HTML(示例)
<div id = "wrapper">
<div class = "aboutleft">
<h1> About us </h1>
<h3> small description </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tristique non odio nec
A few sentences about you go here
</p>
</div>
<div class = "vline"></div>
<div class = "aboutright">
<h1> About the shop/Clients </h1>
<h3> small description </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tristique non odio ne
A few sentences about you go here
</p>
</div>
</div>
CSS
.aboutleft
{
display:inline-block;
float:left;
width: 450px;
}
#wrapper
{
text-align:center;
width: 80%;
margin: 0, auto;
}
.aboutright
{
display: inline-block;
float:right;
width: 450px;
}
.vline
{
background: rgb(186,177,152);
display: inline-block;
float: left;
min-height: 250px;
margin: 0 30px;
width: 1px;
}
这样做的结果是 3 个 div 大部分都向左浮动。我想将它们三个都集中在页面上。