对齐图像中心,响应div的底部

Spe*_*cer 1 html css center alignment

<div id="banner" class="cf">
        <div class="banner container">
            <hr/>
            <p class="banner-text">
            Some text here
            <span class="sub-bt">That's it.</span>
            </p>
            <a href="#" rel="nofollow" class="learn-btn">Learn More</a>

            <img src="<?php echo get_template_directory_uri(); ?>/library/images/responsive_ex.png" class="res-ex">
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

到目前为止,这是该问题的代码.我需要将图像与"res-ex"类放在div类的"banner"的底部.

我尝试了多个表格单元格和位置代码,但似乎无法让它工作.

设计也很敏感.

Pau*_*e_D 11

您可以使用定位将图像放置在div的底部,然后使用CSS变换将其居中.

.wrap {
    height: 400px;
    position: relative;
    background: #f09d09;
}

.wrap img{
    display: block;
    max-width: 100%;
    position: absolute;
    bottom:0;
    left:50%;
    transform:translateX(-50%);
    
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrap">
    <img src="http://lorempixel.com/400/200/" alt=""/>
</div>
Run Code Online (Sandbox Code Playgroud)

JSFiddle演示