-1

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

小提琴: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;
}
4

1 回答 1

0

按照弗朗西斯科·普雷森西亚 (Francisco 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;
}

新的html:

<div id="notesdisplay"><div id="notestext">TEXT</div></div>
于 2013-11-02T01:37:32.590 回答