2011-04-30 77 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; 

您需要与利润率左两个图像,以将其推入调整,但我敢肯定,你可以明白这一点之多。