简体   繁体   English

一个特定的班级应该显示 <div> 具有oveflow:隐藏属性

[英]A particular class should Show though <div> has oveflow:hidden property

I am having trouble creating a popup "CLOSE" text button . 我在创建弹出的“关闭”文本按钮时遇到了麻烦。 Popup Box have CSS property : overflow:scroll and position:absolute . 弹出框具有CSS属性:溢出:滚动和位置:绝对。

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

But I want to move the "CLOSE" text at the top left out side of the <div> . 但是我想将<CLOSE>文本移到<div>左上角。 So that when scroll the "CLOSE" text Show remain at top left out side the div . 这样,当滚动“关闭”文本显示时,div仍位于左上方。 May be this can be done having a Wrapper Div around that div BUT he main problem is can't use any wrapping that div . 也许在那个div周围有一个包装Div可以做到这一点, 但是他的主要问题是不能使用该div的任何包装。 Is this possible to make ? 这有可能吗?

Place The CLOSE text at top left outside that div . 将CLOSE文本放在该div的左上方。

properties of the class can't be remove any But can be add if necessary . 该类的属性不能删除,但必要时可以添加。 If need any jquery or java scripts No problem . 如果需要任何jquery或java脚本,没问题。 But I am Stuck and I want a result to find . 但是我很困,我想要找到结果。

Any help would be appreciated . 任何帮助,将不胜感激 。

HTML 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 CSS

.popup{
height:100px;
overflow:scroll;
width:400px;
background:#fafafa;
margin-top:50px;
position:absolute;
}
.close{
  color:red;
}

You can do this with position: fixed 您可以使用position: fixed

DEMO jsFiddle 演示jsFiddle

.close{
   color:red;
    position:fixed;
    z-index:1000;
    top:10px;
    left: 0;
}

How about you reorganize your css, make only the content overflow hidden: 如何重组CSS,仅隐藏内容溢出:

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

.popup{
    position:absolute;
}
.popup .content {
    height:100px;
    overflow:scroll;
    width:400px;
    background:#fafafa;
    margin-top:50px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM