强制溢出到顶部而不是底部 [英] Forcing overflow to top instead of bottom

查看:31
本文介绍了强制溢出到顶部而不是底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的内容在 div 中溢出到顶部和左侧而不是右下角.

目的是当展开 div 时,看起来内容是从顶部而不是底部进来的.

有什么办法可以做到这一点是 CSS?就像您为文本设置 vertical-align 的方式一样,我希望 div 溢出到顶部而不是底部

解决方案

这样的事情就可以解决问题.

jsfiddle

HTML

<div class="overflow"></div>

CSS

.wrapper {位置:相对;宽度:100px;高度:100px;背景:#eee;}.wrapper .overflow {位置:绝对;底部:0;右:0;背景:#000;宽度:50px;高度:150px;}

I would like my content to overflow to the top and left instead of the bottom right in a div.

The purpose is that when expanding the div it looks like the content is coming in from the top instead from the bottom.

Is there any way to do this is CSS? Much like the way you set vertical-align for text, I would like to have the div overflow to the top instead of the bottom

解决方案

Something like this would do the trick.

jsfiddle

HTML

<div class="wrapper">
    <div class="overflow"></div>
</div>

CSS

.wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    background: #eee;
}

.wrapper .overflow {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #000;
    width: 50px;
    height: 150px;
}

这篇关于强制溢出到顶部而不是底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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