2011-04-30 58 views
2

所以我的頁面是here,正如你可以在中間看到我試圖(不成功)讓兩個圖像適合灰色方塊......每邊一個。這裏是我的html如何正確對齊此Css

<div class="top_center_image"> 
    <div class="left_image"> 
    </div> 
    <div class="right_image"> 
    </div> 
    </div> 

,這裏是我的CSS

.top_center_image{ 
    background: url("../image/TopBox.png") no-repeat; 
    height: 179px; 
    margin-left: 5px; 
    width: 649px; 
} 
.left_image{ 
    background: url('../image/DwightWorldVideoleft.png') top left no-repeat; 
    width: 296px; 
    height:152px; 
    margin-left:11px; 
    float:left; 
} 

.right_image{ 
    background: url("../image/AMWimage.png") no-repeat scroll left top transparent; 
    height: 152px; 
    margin-left: 11px; 
    width: 311px; 
    float:right; 
} 

有排隊這一切了一種更簡單,更好的方法.....在此先感謝

回答

1

試試這個,

刪除保證金左:無論從.left_image 11像素和.right_image 添加如下

.left_image {margin: 10px;} 
.right_image {margin: 10px;} 
2

下工作我...

.right_image { 
background: url("../image/AMWimage.png") no-repeat scroll left top transparent; 
float: right; 
height: 152px; 
margin-right: 12px; 
margin-top: 12px; 
width: 311px; 

}

.left_image { 
background: url("../image/DwightWorldVideoleft.png") no-repeat scroll left top transparent; 
float: left; 
height: 152px; 
margin-left: 11px; 
margin-top: 12px; 
width: 296px; 

}

我加邊距規則兩者。我從右側圖像中刪除了保證金,並在其位置添加了保證金。

0

我剛添加的top_center_image內其他的div容器來包裝這兩個圖像,將兩個圖像設置爲向左浮動,而不是一個向左和向右。然後風格的新的div使用該

width:630px; height:155px;margin-left:10px; padding-top:14px; 

您需要與利潤率左兩個圖像,以將其推入調整,但我敢肯定,你可以明白這一點之多。