为什么当我设置溢出属性为隐藏,然后一个伪元素消失
Why when I set overflow property to hidden, then a pseudo element goes away?
下面是我的代码:
.user_inbox{
position:absolute;
background-color: #fff;
border-radius:2px;
-o-border-radius:2px;
-moz-border-radius:2px;
-webkit-border-radius:2px;
-ms-border-radius:2px;
box-shadow: 0px 0px 6px #ccc;
-o-box-shadow: 0px 0px 6px #ccc;
-moz-box-shadow: 0px 0px 6px #ccc;
-webkit-box-shadow: 0px 0px 6px #ccc;
-ms-box-shadow: 0px 0px 6px #ccc;
width: 310px;
direction:ltr;
left:53px;
top:63px;
border:1px solid #CCC;
z-index:5000;
height:100%;
max-height:55%;
min-height:180px;
right: 53px;
top: 65px;
/* overflow:hidden; */
}
.user_inbox:after{
background-color: #fff;
box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
-o-box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
-moz-box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
-webkit-box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
-ms-box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
content: "'00a0";
display: block;
height: 12px;
width: 12px;
margin-left:18px;
position:absolute;
top:-5px;
transform:rotate(135deg);
-moz-transform:rotate(135deg);
-ms-transform:rotate(135deg);
-webkit-transform:rotate(135deg);
-o-transform:rotate(135deg);
background-color: #F7F7F7;
right: 18px;
}
.title{
background-color: #F7F7F7;
display:block;
width; 100%;
height: 20px;
text-align: center;
padding: 5px;
}
<div class="user_inbox">
<span class="title">there is a title</span>
</div>
现在请删除这一行周围的注释:overflow:hidden;
(我的意思是请取消注释)…然后突然向上的箭头就会消失。
我需要这个向上的箭头和这个属性overflow:hidden;
。我该怎么做呢?
overflow:hidden
是游戏结束的子元素试图弹出它的父溢出边界。
相反,创建一个会溢出(隐藏)的内部容器
.overflow{
position: relative;
overflow:hidden;
height: inherit;
width: inherit;
background: #cf5;
}
.user_inbox{
position:absolute;
background-color: #fff;
border-radius:2px;
box-shadow: 0px 0px 6px #ccc;
width: 310px;
direction:ltr;
left:53px;
top:63px;
border:1px solid #CCC;
z-index:5000;
height:100%;
max-height:55%;
min-height:180px;
right: 53px;
top: 65px;
}
.user_inbox:after{
background-color: #fff;
box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, 0.4 );
content: "'00a0";
display: block;
height: 12px;
width: 12px;
margin-left:18px;
position:absolute;
top:-5px;
transform:rotate(135deg);
-moz-transform:rotate(135deg);
-ms-transform:rotate(135deg);
-webkit-transform:rotate(135deg);
-o-transform:rotate(135deg);
background-color: #F7F7F7;
right: 18px;
}
.title{
background-color: #F7F7F7;
display:block;
width; 100%;
height: 20px;
text-align: center;
padding: 5px;
}
<div class="user_inbox">
<div class="overflow">
<span class="title">there is a title</span>
</div>
</div>
或"bottom" (标题下方);
.overflow{
position: relative;
overflow:hidden;
width: inherit;
background: #cf5;
max-height:55%;
min-height:180px;
}
.user_inbox{
position:absolute;
background-color: #fff;
border-radius:2px;
box-shadow: 0px 0px 6px #ccc;
width: 310px;
direction:ltr;
left:53px;
top:63px;
border:1px solid #CCC;
z-index:5000;
/*height:100%;
max-height:55%;
min-height:180px; */
right: 53px;
top: 65px;
}
.user_inbox:after{
background-color: #fff;
box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, 0.4 );
content: "'00a0";
display: block;
height: 12px;
width: 12px;
margin-left:18px;
position:absolute;
top:-5px;
transform:rotate(135deg);
-moz-transform:rotate(135deg);
-ms-transform:rotate(135deg);
-webkit-transform:rotate(135deg);
-o-transform:rotate(135deg);
background-color: #F7F7F7;
right: 18px;
}
.title{
background-color: #F7F7F7;
display:block;
width; 100%;
height: 20px;
text-align: center;
padding: 5px;
}
<div class="user_inbox">
<span class="title">there is a title</span>
<div class="overflow"></div>
</div>
相关文章:
- I'我设计了一个下拉菜单,onclick会出现,而on blur会消失
- 单击一个按钮,直到它在CasperJS中消失
- angularJS,一个部分或模态通知,加载几秒钟后就会消失
- 如何制作一个在html中完成后消失的gif
- 如何防止焦点从一个文本字段更改为另一个文本字段时屏幕键盘消失
- Bootstrap-select.js-选择一个选项后,整个选择将消失
- 如何使跨度在单击时出现,但在单击另一个链接时消失
- 如果我单击第一个product_widget,我如何使消失produst_name在第一个 product_widget
- 当使用 jquery 出现另一个文本时,使文本消失
- 从一个对象悬停到另一个对象,而第二个DOM对象不会立即消失
- 循环通过LI's在一个顺序中,然后返回另一个顺序,同时逐渐消失
- 我正在一个HTML5画布上工作,并试图在上面画圆圈,但当我试图使用循环时,一切都消失了
- 为什么第二次我悬停在一个元素上时它就消失了
- jQuery:将鼠标悬停在一个元素上会使另一个元素褪色,但当鼠标悬停在该元素上时,它会消失
- 如何使谷歌地图标记消失一个接一个
- 使连续的图像只出现在最后一个消失后,而悬停
- 如何禁用条形图中消失时,点击一个项目的图例
- 创建一个带有setInterval块的JS函数,直到timer消失
- 我想要一个动画触发活动,并继续一旦活动状态消失
- 在将元素附加到页面后,转到另一个页面,然后返回,附加的元素就消失了