使用CSS在父元素上方显示子元素 [英] Show child element above parent element using CSS

查看:1001
本文介绍了使用CSS在父元素上方显示子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个div,一个嵌套在另一个里面。父元素具有定义的宽度/高度。如何显示孩子div上面的父(外部)只使用CSS?

I have two divs, one nested inside of the other. The parent element has a defined width/height. How can I show the child div above the parent (outside of it) using only CSS?

编辑:对不起,也许我应该澄清一下,我的意思是上面沿着z轴。是的,我已经尝试z-index。我的问题是,当子元素大于父元素时,会产生一个框架或窗口效果,切断一部分div。

Sorry, maybe I should clarify that I mean "above" as along the z axis. And yes, I already tried z-index. My problem is that when the child element is larger than the parent, it results in a "frame" or "window" effect, cutting off part of the div.

推荐答案

在父div上设置 overflow:visible; p>

Set overflow: visible; on the parent div.

#parent {
    overflow: visible;
}

已更改以反映asker的更新。

Changed to reflect asker's update.

这篇关于使用CSS在父元素上方显示子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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