div:干扰其他div之前/之后?

时间:2012-06-25 17:44:18

标签: html css

我正在使用CSS:before和:after将虚线视觉元素添加到div:

enter image description here

但它似乎干扰了'编辑'按钮元素。 (编辑按钮不会响应任何onClick或MouseOver或Hover事件,而父div:在之前和之后:CSS之后)任何想法如何在'之前和之后'元素之前呈现按钮元素,除了Z指数?

CSS:

.window_header{
    width:600px;
    height:42px;
    background: #333 url("../img/bg-2.png") repeat;
    -webkit-border-top-left-radius: 8px;
    -webkit-border-top-right-radius: 8px;
    border-bottom:1px dotted #666;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3),inset 0 -4px 5px rgba(0, 0, 0, 0.2),inset 1px 0px 1px rgba(0, 0, 0, 0.7),inset -1px 0px 1px rgba(0, 0, 0, 0.7),inset 0 -2px 1px rgba(0, 0, 0, 0.5),inset 0 2px 6px rgba(255, 255, 255, 0.15),inset -2px 0 6px rgba(255, 255, 255, 0.15),inset 2px 0 6px rgba(255, 255, 255, 0.15);
}

.window_header:before,
.window_header:after{
    content: "";
    position: absolute;
    top: 0;
    right: 0px;
    bottom: 562px;
    left: 0px;
    z-index:1;
    border-bottom: 1px dashed #666;
    background:-webkit-gradient(radial, center center, 0, center center, 260, from(rgba(255, 255, 255, 0.05)), to(rgba(255, 255, 255, 0)));
}

.button_edit{
    margin: 8px 8px 8px 8px;
    border-radius:6px;
    width:70px;
    font-size: 9pt;
    font-weight:bold;
    cursor:pointer;
    font-family: Helvetica, sans-serif;
    text-shadow: 0px -1px 1px rgba(0,0,0,0.5);
    border: 1px solid rgba(0, 0, 0, 0.5);
    border-top-color: rgba(0, 0, 0, 0.496094);
    -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2),0 -1px 1px rgba(0, 0, 0, 0.3);
    z-index:100;
}

.fl_right{
    float:right;
}

HTML:

<div class="window_header">
    <div class="button_edit fl_right" id="button_edit_site"> Edit </div>
</div>

1 个答案:

答案 0 :(得分:0)

我想您忘了将position: relative添加到.button_editz-index需要relative / absolute才能工作:

http://jsfiddle.net/CB2BE/1/

.button_edit{
    position: relative;
    z-index:100;
}