添加滚动条时,带箭头的CSS框消失

时间:2013-11-01 20:48:31

标签: jquery html css

我在suedo元素之前和之后由CSS生成的框的顶部中间有一个箭头。但是,当我在框中添加overflow-y:scroll;时,css生成的箭头会消失。

FIDDLE: http://jsfiddle.net/aaronmallen/FP5jr/

CSS:

#notesdisplay {
    position: relative;
    background: #E8E8E8 ;
    border: 3px solid #000000;
    display: box;
    max-width: 500px;
    max-height: 200px;
    padding: 25px;
}
#notesdisplay:after, #notesdisplay:before {
    bottom: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

#notesdisplay:after {
    border-color: rgba(255, 255, 255, 0);
    border-bottom-color: #E8E8E8;
    border-width: 10px;
    left: 50%;
    margin-left: -10px;
}
#notesdisplay:before {
    border-color: rgba(21, 83, 132, 0);
    border-bottom-color: #000000;
    border-width: 14px;
    left: 50%;
    margin-left: -14px;
}

#notesdisplay2 {
    position: relative;
    background: #E8E8E8 ;
    border: 3px solid #000000;
    display: box;
    max-width: 500px;
    max-height: 200px;
    padding: 25px;
    overflow-y:scroll;
}
#notesdisplay2:after, #notesdisplay2:before {
    bottom: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

#notesdisplay2:after {
    border-color: rgba(255, 255, 255, 0);
    border-bottom-color: #E8E8E8;
    border-width: 10px;
    left: 50%;
    margin-left: -10px;
}
#notesdisplay2:before {
    border-color: rgba(21, 83, 132, 0);
    border-bottom-color: #000000;
    border-width: 14px;
    left: 50%;
    margin-left: -14px;
}

1 个答案:

答案 0 :(得分:0)

执行弗朗西斯科·普雷森西亚(Frank Presencia)用div包装文本的内容。

新css:

#notestext {
    width: 500px;
    height: 200px;
    overflow-y:scroll;
}
#notesdisplay {
    position: relative;
    background: #E8E8E8 ;
    border: 3px solid #000000;
    display: box;
    max-width: 500px;
    max-height: 200px;
    padding: 25px;
}
#notesdisplay:after, #notesdisplay:before {
    bottom: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

#notesdisplay:after {
    border-color: rgba(255, 255, 255, 0);
    border-bottom-color: #E8E8E8;
    border-width: 10px;
    left: 50%;
    margin-left: -10px;
}
#notesdisplay:before {
    border-color: rgba(21, 83, 132, 0);
    border-bottom-color: #000000;
    border-width: 14px;
    left: 50%;
    margin-left: -14px;
}

new html:

<div id="notesdisplay"><div id="notestext">TEXT</div></div>