所以我的页面是here正如您在中间看到的那样,我正在尝试(未成功)将两个图像放入灰色框中......每一侧一个。这是我的 html
<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;
}
有没有一种更简单、更好的方法来排列所有这些......提前致谢
最佳答案
以下内容对我有用......
.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;
}
我为两者都添加了 margin-top 规则。我从右侧图像中删除了 margin-left,并在其位置添加了 margin-right。
关于html - 如何正确对齐此 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5843155/