繁体   English   中英

使用border-radius创建自定义形状

[英]Creating a custom shape with border-radius

我想创建一个这样的形状:

在此输入图像描述

它应该适合屏幕,它应该在左侧切割。

我怎样才能做到这一点?

我现在拥有的是:

  .shape { height: 92vw; width: 100vw; background-color: red; position: absolute; bottom: 0px; border-radius: 92vw 0px 0px 0px; } 
 <div class="shape"></div> 

我用SVG解决了这个问题。

谢谢你和费耶拉!

 html, body { margin: 0; } #shape { position: absolute; bottom: 0px; } 
 <svg id="shape" data-name="Form crop" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 928.08"><defs><style>.cls-1{fill:#ecdbb0;opacity:0.6;}</style></defs><title>shape</title><path class="cls-1" d="M2379.69,1551.29V623.21c-603.05,53.25-876.26,317.23-999.59,558.26l-0.41.8v369h1000Z" transform="translate(-1379.69 -623.21)"/></svg> 

您可以使用伪元素

 html, body { margin: 0; } .shape { height: 100vh; width: 100vw; position: relative; overflow: hidden; } .shape:before { content: ''; height: 250vh; width: 250vw; background-color: #ecdbb0; position: absolute; top: 20px; left: -20vw; border-radius: 50%; } 
 <div class="shape"></div> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM