Pierre G
Pierre G

Reputation: 39

Css Triangle with border and boder radius one point

I must make this shape in css:

enter image description here

But I can not make the rounding on the point of the triangle in css. Here is my code :

.contour {
  padding: 60px 40px 40px 40px;
  margin: 10px;
  width: auto;
  -webkit-border-radius: 11px;
  -moz-border-radius: 11px;
  border-radius: 11px;
  border: solid 3px #FD8906;
  position: relative;
  background-color: #FFF;
}
.contour:after,
.contour:before {
  top: -3px;
  left: 10%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
}
.contour:after {
  border-color: rgba(255, 255, 255, 0);
  border-top-color: #ffffff;
  border-width: 33px;
  margin-left: -33px;
}
.contour:before {
  border-color: rgba(253, 137, 6, 0);
  border-top-color: #FD8906;
  border-width: 38px;
  margin-left: -38px;
}
<html>
<div class="contour">
</div>

</html>

https://jsfiddle.net/dxjv2jus/

Can you help me please

Upvotes: 3

Views: 489

Answers (1)

Mohammad Usman
Mohammad Usman

Reputation: 39392

You can make it by drawing a rounded square box and applying rotation to it.

html{  background-color:#FFF;}
.contour {
  position: relative;
  overflow: hidden;
  margin:10px;
}
.contour-holder {
  padding:60px 40px 40px 40px;
  width:auto;
  -webkit-border-radius: 11px;
  -moz-border-radius: 11px;
  border-radius: 11px;
  border:solid 3px #FD8906;
  position: relative;
  background-color:#FFF;
}	

.contour:before {
  transform: rotate(-45deg);
  border-radius: 0 0 0 10px;
  left: 10%;
  border:solid 3px #FD8906;
  background: white;
  content: " ";
  height: 40px;
  width: 40px;
  position: absolute;
  pointer-events: none;
  top: -23px;
  z-index: 10;
}
<div class="contour">
  <div class="contour-holder">
  
  </div>
</div>

Upvotes: 1

Related Questions