2013-11-01 100 views
0

我有3個div我想要水平對齊,我用這個代碼在我的網站上的其他divs,他們正在工作,有什麼我在這些失蹤? example水平對齊3 divs

#christmas_product_boxes{width:1000px; height:auto;} 
.christmas_boxes {float:left; width:300px; height:auto;} 
.christmas_boxes + .christmas_boxes {margin-left:20px;} 
.christmas_boxes > div {width:300px; height:auto; clear:both;} 
.christmas_mattress_title {color:#000000;} 
.christmas_pillows_title {color:#2B436B;} 
.christmas_beds_title {color:#333333;} 
.christmas_mattress_text {font-size:13px;} 
.christmas_pillows_text {font-size:12px;} 
.christmas_beds_text {font-size:11px;} 

回答

1

各副箱需要有.christmas_boxes類,像這樣:

<div id="christmas_product_boxes"> 
    <div class="christmas_boxes"> 
     <div class="christmas_mattress"> 
     ... 
    </div> 
    <div class="christmas_boxes"> 
     <div class="christmas_pillows"> 
     ... 
    </div> 
    <div class="christmas_boxes"> 
     <div class="christmas_beds"> 
     ... 
    </div> 
</div>