我无法创建弹出“关闭”文本按钮。 Popup Box有CSS属性: 溢出:滚动和位置:绝对。
JS小提琴:http://jsfiddle.net/saifrahu28/qkfRr/
但我想移动<div>
左上方的“关闭”文字。因此,当滚动“关闭”文本时,显示保留在div的左上方。也许这可以做到有一个Wrapper Div围绕div 但他的主要问题是不能使用任何包装div。这有可能吗?
将CLOSE文本放在div旁边的左上角。
类的属性不能删除任何但可以在必要时添加。如果需要任何jquery或java脚本没问题。但我被困了,我想要找到一个结果。
任何帮助都将不胜感激。
HTML
<div class="popup">
<p class="close">CLOSE</p>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled
it to make a type specimen book. It has survived not only five centuries,
but also the leapinto electronic typesetting, remaining essentially
unchanged. It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more
recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.
</p>
</div>
CSS
.popup{
height:100px;
overflow:scroll;
width:400px;
background:#fafafa;
margin-top:50px;
position:absolute;
}
.close{
color:red;
}
答案 0 :(得分:1)
您可以使用position: fixed
DEMO jsFiddle
.close{
color:red;
position:fixed;
z-index:1000;
top:10px;
left: 0;
}
答案 1 :(得分:0)
你如何重新组织你的CSS,只让内容溢出隐藏:
.popup{
position:absolute;
}
.popup .content {
height:100px;
overflow:scroll;
width:400px;
background:#fafafa;
margin-top:50px;
}