CSS新创建的div应该落后于先前的div

时间:2019-02-26 11:52:36

标签: css css3 transform

在这里,我正在尝试创建浏览器标签。

JsFiddle

.intrnlTabs {
    background: #f0f1f3;
    height: 35px
}
.intrnlTab {
    background: #e7e9ec;
    display: inline-block;
    height: 30px;
    text-align: left;
    margin-top: 5px;
    line-height: 35px;
    border-top-left-radius: 10px;
    position: relative;
    margin-left: 12px
}
.intrnlTxt {
    display: inline-block;
    max-width: 150px;
    height: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    min-width: 30px;
    padding: 0 20px 0 10px
}
.intrnlCls {
    position: absolute;
    right: -23px;
    height: inherit;
    background: #dee1e5;
    box-sizing: border-box;
    top: 0;
    width: 33px;
    transform: skewX(30deg);
    border-top-right-radius: 5px;
    cursor: pointer;
    display: inline-block;
    text-align: center
}
.intrnlCls:hover {
    background: #d7d8d8
}
.intrnlClsicon {
    transform: skewX(-30deg);
    display: inline-block
}

输出我得到的信息

enter image description here

输出期望的结果

enter image description here

我希望新添加的标签页眉应位于前一个标签页的后面,而不添加z-index值。我已经实现了添加z-index值。但是,我不想添加z-index值。

1 个答案:

答案 0 :(得分:2)

您无需为每个项目计算特定的 z-index,也无需通过JS对其进行分配。

向这些“ X”项目添加1的z-index已经足以实现您想要的目标:

.intrnlCls { z-index:1; }
相关问题