我如何将一个贴在不同大小div底部的图像居中? [英] How do I centre an image that sticks to the bottom of a varying size div?

查看:130
本文介绍了我如何将一个贴在不同大小div底部的图像居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使图像居中并使图像下沉/粘贴在其所包含的div的底部?

How do I centre an image and make the image sink/stick to the bottom of the div it is contained within?

<div class="cover">
    <img class="cover_img" src="img/index/banner_me.png">
</div>

.cover {
    width: 100%;
    height: 100%;
    min-height: 850px;
}

    .cover_img {
        width: 850px;
        height: 660px;
        margin: 0 auto;
    }

如果可能作为div的背景图像,那将是理想的没有一个会好起来的。对不起我的简单问题。

It would be ideal if its possible as a background image to the div but if not an will be okay. Sorry for my simple question.

推荐答案

background-position:center 100%;

http://jsfiddle.net/Curry/Suw4t/

这篇关于我如何将一个贴在不同大小div底部的图像居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆