溢出隐藏和绝对位置

时间:2013-12-05 12:46:40

标签: html css

在以下标记中,我想设置.wrap之外的内部位置以获得以下结果:

enter image description here

但问题是.wrapoverflow: hidden自动生成且无法更改。有没有其他方法可以在不改变.wrap的css的情况下实现相同的结果?

HTML:

<div class="wrap">
    <div class="box">
        <div class="inner"></div>
    </div>
</div>

CSS:

.wrap{
    overflow: hidden; /* problem */
    width: 200px;
    height: 200px;
    background: yellow;
    position: relative;   
}

.inner{
    width: 10px;
    height: 100%;
    position: absolute;
    right: -50px;
    top: 0;
    background: green;
    z-index: 3;        
}

的jsfiddle: http://jsfiddle.net/bAGTg/

2 个答案:

答案 0 :(得分:4)

仅在.wrap添加overflow:visible !important;

答案 1 :(得分:0)

将其替换为您的代码..

.wrap{
    overflow: visible;
    width: 200px;
    height: 200px;
    background: yellow;
    position: relative;   
}

祝你好运..