我知道这是一个拉出的问题,但所有示例都可以在网上找到,因为某些原因,我无法复制。如何以特定宽度居中彼此相邻的2个div
我需要2个300像素的div盒子;彼此相邻并且居中居中。
我有以下代码
<div class="container">
<div class="box1"></div>
<div class="box2"></div>
</div>
<style>
.container {
width:100%;
text-align:center";
}
.box1 {
float:left;
width:300px;
}
.box2 {
float:right;
width:300px;
}
</style>
无论出于何种原因,我能得到彼此相邻的箱子,但它停留在屏幕上,而不是中心的左侧。我只需要他们集中
爱你:)该做的感谢 –