更新时间:2023-01-05 15:52:12
您可以在右侧添加相同的样式border-radius
,占据剩下的30%.
You could just add the same style border-radius
to the right, taking up the other 30% you have left over.
body {
background: lightblue;
}
#box {
width: 500px;
height: auto;
border-bottom: 3px solid green;
-moz-border-radius-bottomleft: 70% 40px;
-webkit-border-bottom-left-radius: 70% 40px;
-moz-border-radius-bottomright: 30% 20px;
-webkit-border-bottom-right-radius: 30% 20px;
-webkit-box-shadow: 0 3px 7px 0 rgba(0, 0, 0, 0.91);
box-shadow: 0 3px 7px 0 rgba(0, 0, 0, 0.91);
}
<img id="box" src="http://www.hdwallpapersinn.com/wp-content/uploads/2014/11/Sunset-Cityscape-Scene.jpg" />
您也可以考虑使用clip-path
来获取所需的区域.可悲的是,这不允许box-shadows
You could also look into using a clip-path
to get the area you want. Sadly, this doesn't allow for box-shadows
body {
background: lightblue;
}
.container {
-webkit-clip-path: ellipse(100% 56% at 71% 39%);
clip-path: ellipse(100% 56% at 71% 39%);
width: 500px;
height: auto;
background: green;
}
img {
-webkit-clip-path: ellipse(100% 56% at 71% 39%);
clip-path: ellipse(100% 56% at 71% 39%);
width: 500px;
height: auto;
}
<div class="container">
<img src="http://www.hdwallpapersinn.com/wp-content/uploads/2014/11/Sunset-Cityscape-Scene.jpg" />
</div>
您还可以使用SVG获得所需的形状.
You can also achieve the shape required with an SVG.
body {
background: lightblue;
}
<svg width="500" height="250" viewBox="0 0 100 50">
<defs>
<pattern id="image" patternUnits="userSpaceOnUse" height="50" width="100">
<image x="0" y="0" height="50" width="100" xlink:href="https://31.media.tumblr.com/cd4319a4a4ba642649bcf7936d48eec8/tumblr_inline_mn089qqjI71qz4rgp.png"></image>
</pattern>
<filter id="blur" x="0" y="0" width="100%" height="110%">
<feOffset result="offOut" in="SourceAlpha" dx="0" dy="1" />
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="2" />
<feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
</filter>
</defs>
<g class="curve">
<path fill="url(#image)" filter="url(#blur)" stroke="green" stroke-width="1" d="M-1,-1
L-1,40
C-1,40 60,45 101,42
L101,-1z" />
</g>
</svg>
body {
background: lightblue;
margin: 0;
padding: 0;
}
<svg width="100%" viewBox="0 0 100 50" preserveAspectRatio="none" height="150px">
<defs>
<filter id="blur" x="0" y="0" width="100%" height="110%">
<feOffset result="offOut" in="SourceAlpha" dx="0" dy="1" />
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="2" />
<feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
</filter>
</defs>
<path fill="#ffffff" filter="url(#blur)" stroke="green" stroke-width="1" d="M-1,-1
L-1,40
C-1,40 60,45 101,42
L101,-1z" />
</svg>