Belle icon shape in CSS

前端 未结 4 811
时光取名叫无心
时光取名叫无心 2021-01-06 21:54

How can I draw this Belle icon shape in CSS only?

\"enter

I\'ve tried the bor

4条回答
  •  心在旅途
    2021-01-06 22:13

    Well, in order to achieve the exact effect, we cannot rely on a single element even if we use percentage on border-radius.

    So one option could be using two (pseudo-)elements overlapping each other where one of them is rotated by 90deg:

    div {
      width: 300px;
      height: 300px;
      
      /* Just for demo */
      width: 95vmin; height: 95vmin;
      
      position: relative;
    }
    
    div:after, div:before {
      content: "";
      background: teal;
      position: absolute;
      top: 0;
      left: 8%;
      right: 8%;
      bottom: 0;
      border-radius: 50% / 22%;
    }
    
    div:before {
      transform: rotate(-90deg); /* vendor prefixes omitted due to brevity */
    }

提交回复
热议问题