将div内的CSS对齐到右下角 [英] Align inside div to right bottom in CSS

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

问题描述

将我的内部div放到右下角的最简单方法是什么?

what is the easiest way to put my inside div to bottom right corner?

<div style="width:200px; height:200px; border:3px #FF6666 solid">
<div style="font-weight:bold; text-align:right;">Krishna</div>
</div>

这是我的代码.谢谢大家

This is my code.. Thank you all

推荐答案

尝试一下,将外部 div 设置为 position:relative; ,确保内部设置为 position:absolute; 时,div 将保留在其中.然后,您可以通过设置 bottom:0;来指定它位于右下角.正确:0; .

Try this, setting your outer div to position: relative; ensure that the inner div will stay inside it when set to position: absolute;. Then you can specify it to sit in the bottom right corner by setting bottom: 0; right: 0;.

<div style="width:200px; height:200px; border:3px #FF6666 solid; position: relative">
  <div style="font-weight:bold; text-align:right;position: absolute;bottom: 0; right: 0; ">Krishna</div>
</div>

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

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