Home > database >  Draw special shapes in Css3
Draw special shapes in Css3

Time:11-22

I'm looking for a way to draw a special shape like in the picture using Css3. Any idea or drawing way to draw that shape using Css3?

Image

I have referenced several ways but it just draws into a normal triangle.

<div id="shape"></div>

#shape{
    width: 0;
    height: 0;
    border-left: 72px solid transparent;
    border-right: 0px solid transparent;
    border-bottom: 72px solid red;    
}

CodePudding user response:

you can add border-bottom-right-radius in your #shape css. you just need to set the border-left to white or depending on your background color of your div to match the color

#shape {
    width: 0;
    border-left: 72px solid white;
    border-right: 0px solid transparent;
    border-bottom: 72px solid red;
    border-bottom-right-radius: 20px;
}
<div id="shape"></div>

CodePudding user response:

Use clip-path property in CSS and make shapes in images. You can read about clip-paths in w3Schools. here is a refrence link https://www.w3schools.com/CSSREF/css3_pr_clip-path.php

There are more resources and i do recommend reading about polygons.

CodePudding user response:

it can be done using an after element on shape

#shape{
    width: 100px;
    height: 100px;
    border-left: 0px solid transparent;
    border-top: 0px solid transparent;
    border-right: 1px solid blue;
    border-bottom:1px solid blue;    
    border-bottom-right-radius: 25px;
    position: relative;
    overflow: hidden;
}
#shape::after{
  content:"";
  position: absolute;
  background-color: blue;
  width: 1px;
  height: 150%;
  bottom: 0;
  transform-origin: bottom;
  transform: rotateZ(45deg);
}
<div id="shape"></div>

CodePudding user response:

Try https://bennettfeely.com/clippy/ (this is an online clip path making website) and border radius. If you still can't, let me know, I will explain it to you. But give a try first. BTW you will not be able to draw the outer blue border.

  • Related