A. *_*iaz 9 html css rounded-corners css-shapes
我一直试图用不均匀的圆形边做DIV,如下所示:
我已经检查了一些解决方案,我可以通过使用border-radius获得最接近的解决方案.我用过:
border-bottom-left-radius: 80%50px;
border-bottom-right-radius: 30%30px;
Run Code Online (Sandbox Code Playgroud)
如何才能做到这一点?
Tem*_*fif 16
你可以考虑clip-path:
.box {
height: 200px;
width: 200px;
background: blue;
-webkit-clip-path: circle(75% at 65% 10%);
clip-path: circle(75% at 65% 10%);
}Run Code Online (Sandbox Code Playgroud)
<div class="box">
</div>Run Code Online (Sandbox Code Playgroud)
或使用radial-gradient:
.box {
height: 200px;
width: 200px;
background: radial-gradient(circle at 65% 10%, blue 75%,transparent 75.5%);
}Run Code Online (Sandbox Code Playgroud)
<div class="box">
</div>Run Code Online (Sandbox Code Playgroud)
或者使用伪元素并依赖于溢出:
.box {
height: 200px;
width: 200px;
position:relative;
overflow:hidden;
}
.box:before {
content:"";
position:absolute;
top:0;
left:-10%;
right:-10%;
bottom:10%;
background:blue;
border-radius:0 0 50% 100%;
}Run Code Online (Sandbox Code Playgroud)
<div class="box">
</div>Run Code Online (Sandbox Code Playgroud)
让我们不要忘记SVG解决方案(作为常规元素或背景)
svg {
display:inline-block;
}
.box {
display:inline-block;
height:200px;
width:200px;
background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' width='200' height='200' fill='blue'> <path d='M0 0 L0 28 C10 46 30 60 64 48 L64 0 Z' /></svg>")0 0/100% 100% no-repeat;
}Run Code Online (Sandbox Code Playgroud)
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 64 64'
width='200' height='200'
fill='blue'>
<path d='M0 0 L0 28 C10 46 30 60 64 48 L64 0 Z' />
</svg>
<div class="box">
</div>Run Code Online (Sandbox Code Playgroud)
这是一个很容易调整SVG的在线工具 border-radius