简体   繁体   中英

Triangle with rounded tip, with CSS

I'm trying to make a triangle with the rounded top tip, but it just produces a normal triangle and 1/2 circle.

.myT{ 
width: 350px;
    height: 233px;
    background-color: #5cb85c;
    -moz-border-radius:  0% 0% 50% 50% / 0% 0% 100% 100%;
    -webkit-border-radius:  0% 0% 50% 50% / 0% 0% 100% 100%;
    border-radius: 0% 0% 50% 50% / 0% 0% 100% 100%;
}

Use a before element to create a triangle with a blunt tip, and an after element to create a circle to round out the tip.

http://codepen.io/andrewray/pen/QddQWg

.triangle {
  position:relative;
  height:10px;
  width:10px;

  &:before {
    content: '';
    display:block;
    width: 10px;
    height: 10px;
    border-style: solid;
    border-width: 0 100px 100px 100px;
    border-color: transparent transparent #007bff transparent;
  }

  &:after {
    content: '';
    display:block;
    width: 12px;
    height: 12px;
    position:absolute;
    top:8px;
    left:99px;
    border-radius: 100%;
    background:#007bff;
  }
}

圆角三角形

Tweak values as needed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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