CSS: Overflow Auto and Z-index

淺唱寂寞╮ 提交于 2020-01-05 10:29:43

问题


Here's the link: http://jsfiddle.net/smnde/2/

Is there a way to make the list show up above the div when overflow:auto is set? Like in the second container?


回答1:


yes; you can display overflow div outside of anything div when the child is absolute position & it's parent didn't have position:relative

like this:

#button {
    border: 1px solid #999;
    margin: 5px;
}

#hidden {
     display: none;
    position: absolute;
    margin-top:-20px;
    left:190px;
    width: 50px;
    border: 1px solid #333;
}

check this http://jsfiddle.net/sandeep/smnde/26/




回答2:


No, overflow will not display anything outside the box.

You can use a tooltip like hover instead with the hidden box outside the container.

Check: http://jsfiddle.net/smnde/9/



来源:https://stackoverflow.com/questions/7790981/css-overflow-auto-and-z-index

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!