内部DIV锁定到外部DIV的右下角 [英] inner DIV locked to lower right hand corner of outer DIV

查看:197
本文介绍了内部DIV锁定到外部DIV的右下角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定以下HTML

<div style="width: 500px; height: 500px; border: 1px solid red;">
    <div style="width: 200px; height: 100px; border: 1px solid green; float: right; vertical-align: bottom;">
    </div>
</div>

我想内部的div锁在外部div的右下角。我需要做些什么才能做到这一点?

I would like the inner div to lock into the lower right hand corner of the outer div. What do I need to do CSS wise to make that happen?

谢谢!
John

Thanks! John

推荐答案

位置是您的朋友

<div style="width: 500px; height: 500px; border: 1px solid red; position: relative">
    <div style="position: absolute; right: 0; bottom: 0; width: 200px; height: 100px; border: 1px solid green;">
    </div>
</div>

这篇关于内部DIV锁定到外部DIV的右下角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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