为什么我的图像不在底部? [英] Why isn't my image aligning bottom?
问题描述
我觉得这是一个简单的修复,但我的代码不工作,我不知道为什么。
I feel like this is an easy fix but my code isnt working and I'm not sure why.
我想将'voip创新:您的首要批发voip运营商'图像对齐到div的底部。我做了底部的绿色参考。
I want to align the 'voip innovations:your premier wholesale voip carrier' image to the bottom of the div. I made the bottom green for reference.
我尝试了
#cityBackground{
position:relative;
display:table-cell;
vertical-align: bottom;
background-image:url(../images/city_background_line_vi.jpg);
background-repeat:repeat-x;
height:500px;
background-color:green;
}
#cityBackground img{
vertical-align:bottom;
display:block;
margin-left: auto;
margin-right: auto;
}
但它似乎无效。
这是指向该网站的链接
这里有我遗漏的东西吗?
Is there something I'm missing here?
- 编辑 -
对不起,我没有解释清楚。我不想让背景图像向下移动。我想把标志向下移动。
Sorry I didnt explain clear enough. I dont want the background-image moved down. I want the logo moved down.
推荐答案
您可以将 img
到 #cityBackground
。
#cityBackground img {
position: absolute;
bottom: 10px;
left: 50%;
margin-left: -174px;
}
由于 img
width是固定的,可以使用 left:50%
和 margin-left:-174px
值 -174px
是 img
宽度的一半。
Since the img
width is fixed, you could use left:50%
and margin-left:-174px
to center it horizontally. The value -174px
is half the img
width.
这篇关于为什么我的图像不在底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!