How do I create a teardrop in HTML?

后端 未结 12 522
生来不讨喜
生来不讨喜 2020-12-02 03:59

How do I create a shape like this to display on a webpage?

I don\'t want to use images since they would get blurry on scaling

12条回答
  •  温柔的废话
    2020-12-02 04:21

    Basic Border-Radius

    You can do this within CSS relatively easily using border-radius' and transforms. Your CSS was just a little bit out.

    .tear {
      width: 50px;
      height: 50px;
      border-radius: 0 50% 50% 50%;
      border: 3px solid black;
      transform: rotate(45deg);
      margin-top: 20px;
    }

    Advanced Border-Radius

    This will be very similar to above but gives it a bit more shape.

    .tear {
      width: 50px;
      height: 50px;
      border-radius: 80% 0 55% 50% / 55% 0 80% 50%;
      border: 3px solid black;
      transform: rotate(-45deg);
      margin-top: 20px;
    }

提交回复
热议问题