Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

html - 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.

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.

I tried

#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;

    }

But it doesnt seem to work.

Here is a link to the site

Link

Is there something I'm missing here?

  • EDIT -

Sorry I didnt explain clear enough. I dont want the background-image moved down. I want the logo moved down.

Picture for reference

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The CSS property background-position controls where the image sits, not vertical-align. Vertical-align is for content. A background image is not content.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...