[英]How to make a child elements shadow show above parent that has overflow: hidden?
I need to have shadows in the img
element, but since it's wraped in a div that's got overflow: hidden
, the shadows are hidden as well. 我需要在
img
元素中具有阴影,但是由于它被包裹在一个overflow: hidden
的div中overflow: hidden
,阴影也被隐藏了。 What could I adjust here to make the shadows appear? 我在这里可以进行哪些调整以使阴影出现?
.slider-content .slider-image{
position: relative;
float: left;
overflow: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
/*width: 20%;*/
cursor: pointer;
z-index: 120;
max-width: 218px;
max-height: 135px;
margin-right: 1.7%;
}
.slider-content .slider-image img{
width: 100%;
height: 135px;
position: relative;
box-shadow: 0 0 10px 5px #222;
}
The markup is as follows: 标记如下:
<div clss="slider-content">
<div class="slider-image">
<img src=".." />
</div>
<div class="slider-image">
<img src=".." />
</div>
</div>
Since you img
will always fill the .slider-image
, put the shadow on the .slider-image
element. 由于
img
将始终填充.slider-image
,因此请将阴影放在.slider-image
元素上。
.slider-content .slider-image{
position: relative;
float: left;
overflow: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
/*width: 20%;*/
cursor: pointer;
z-index: 120;
max-width: 218px;
max-height: 135px;
margin-right: 1.7%;
box-shadow: 0 0 10px 5px #222;
}
.slider-content .slider-image img{
width: 100%;
height: 135px;
position: relative;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.