我如何使用外部阴影进行折角,并继续到父div阴影,就像这样:

谢谢。
发布于 2015-12-17 23:29:52
CSS背景和边框模块第4级引入the corner-shape property
默认情况下,非零的边界半径定义了一个围绕受影响的角的四分之一椭圆。然而,在某些情况下,需要其他角形状。
corner-shape属性指定半径的重新解释,以定义其他拐角形状。
在您的示例中,应将其设置为bevel
边界半径定义角点处的对角切片。
代码应该是这样的
corner-shape: bevel;
border-radius: 0 0 30px;
box-shadow: 0 0 5px #000;然而,这个规范是一个草案,还没有准备好实施。所以浏览器还没有实现它。但是您可以使用corner-shape preview来查看它是什么样子。
发布于 2015-12-17 23:41:08
我试过这个,有点复杂,但很管用
.box {
width: 200px;
height: 100px;
position: relative;
padding: 25px;
background: none;
}
.box .content {
position: relative;
z-index: 2;
}
.box .the_background {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
}
.box .the_background .square-top-right {
width: 250px;
height: 125px;
position: absolute;
top: 0;
left: 0;
background: #fff;
display: block;
z-index: 3;
}
.box .the_background .square-bottom-left {
width: 225px;
height: 150px;
position: absolute;
bottom: 0;
left: 0;
background: #fff;
display: block;
z-index: 3;
}
.box .the_background:after {
content: '';
width: 35px;
height: 35px;
background: #ddd;
position: absolute;
z-index: 2;
right: 7px;
bottom: 7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-box-shadow: 0px 0px 10px #000;
-moz-box-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
}
.box .the_background .square-shadow {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
}
.box .the_background .square-shadow:before {
content: '';
position: absolute;
left: 0;
width: 250px;
height: 125px;
-webkit-shadow: 0px 0px 10px #000;
-moz-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
}
.box .the_background .square-shadow:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 225px;
height: 25px;
-webkit-shadow: 0px 0px 10px #000;
-moz-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
}<div class="box">
<div class="content">
Lorem ipsum...
</div>
<div class="the_background">
<div class="square-top-right"></div>
<div class="square-bottom-left"></div>
<div class="square-shadow"></div>
</div>
</div>
https://stackoverflow.com/questions/34337586
复制相似问题