1

我在创建弹出“关闭”文本按钮时遇到问题。弹出框有 CSS 属性:overflow:scroll 和 position:absolute。

JS小提琴:http: //jsfiddle.net/saifrahu28/qkfRr/

但我想将左上角的“CLOSE”文本移出<div>. 这样,当滚动“关闭”文本时,显示保持在 div 的左上角。可能这可以通过在该 div 周围有一个 Wrapper 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;
}
4

2 回答 2

1

你可以这样做position: fixed

演示jsFiddle

.close{
   color:red;
    position:fixed;
    z-index:1000;
    top:10px;
    left: 0;
}
于 2013-08-24T17:34:42.643 回答
0

你如何重新组织你的css,只隐藏内容溢出:

http://jsfiddle.net/qkfRr/1/

.popup{
    position:absolute;
}
.popup .content {
    height:100px;
    overflow:scroll;
    width:400px;
    background:#fafafa;
    margin-top:50px;
}
于 2013-08-24T17:34:32.810 回答