[英]how to make inside border-radius in css?
您不應該使用CSS創建復雜的形狀。
請改用SVG。
高亮顯示每條曲線,以便您了解如何創建最終形狀。
<svg viewBox="0 0 100 100" width="200"> <path d="M50 10 C 100 10, 100 90, 50 90" stroke="green" fill="transparent"/><!--Large curve--> <path d="M50 90 C 50 65, 35 50, 10 50" stroke="red" fill="transparent"/><!--Smaller down curve--> <path d="M10 50 C 35 50, 50 35, 50 10" stroke="blue" fill="transparent"/><!--Smaller up curve--> </svg> <svg viewBox="0 0 100 100" width="200"> <path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" stroke="gray" fill="red"/> </svg>
也許有些徑向漸變:
body { background:linear-gradient(pink,yellow); height:100vh; margin:0; } .box { width:150px; height:150px; margin:10px; border-radius:50%; overflow:hidden; position:relative; } .box:before { content:""; position:absolute; top:0; bottom:50%; left:0; right:0; background:radial-gradient(circle at top left,transparent 44%, red 44.5%); } .box:after { content:""; position:absolute; bottom:0; top:50%; left:0; right:0; background:radial-gradient(circle at bottom left,transparent 44%, red 44.5%); }
<div class="box"> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.