【问题标题】:Absolute element appearing below container div's border?绝对元素出现在容器 div 的边框下方?
【发布时间】:2016-02-12 00:33:05
【问题描述】:

谁能告诉我为什么我不能使用 z-index 将此链接定位在它包含 div 的上边框的上方?链接到 jfiddle here。代码如下:

<div class="social_story twitter ellipsis" style="word-wrap: break-word;">
    <a class="floating-icon" href="https://twitter.com/au_cadc" target=
    "_blank"></a>
</div>

.social_story{
    width: 100%;
    height: 358px;
    padding-bottom: 20px;
    margin-top: 20px;
    position: relative;
    background-color: #eeeeee;
    overflow: hidden;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    border-top: 30px solid #dd550c;
}

.floating-icon {
        position: absolute;
    width: 42px;
    height: 42px;
    top: -15px;
    left: 15px;
    background-color: white;
    border-radius: 25px;
    -webkit-transition: all 250ms;
    -moz-transition: all 250ms;
    transition: all 250ms;
    z-index:2;
}

【问题讨论】:

    标签: html css css-position z-index absolute


    【解决方案1】:

    因为您在 .social_story 容器上将 overflow 设置为 hidden

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-16
      • 1970-01-01
      • 2014-10-02
      • 1970-01-01
      • 2018-01-24
      • 1970-01-01
      • 2010-12-04
      相关资源
      最近更新 更多