0

I need your help on button design in a project I prepared. The design looks like a trapezoidal shape, but I couldn't find the result I wanted on the internet. Thank you from now. Button design should be like this

GOKTU
  • 45
  • 4

1 Answers1

1

I think you're having problems finding it because that isn't a trapezoid

You're looking for a notched corner, which is easily achieved with pseudo elements.

div {
  position:relative; /* this one is new - used to contain absolute elements */
  width: 200px;
  height: 80px;
  overflow: hidden;
}

div:after {
  content: "";
  position: absolute;
  margin: -20px;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 40px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 250px #522d5b;
}

The above styling makes something like this:

rectangle with notched corner

Source: https://blog.logrocket.com/how-to-create-fancy-corners-in-css/

I also created a CodeSandbox for you to see how it works in action.

Jacob K
  • 1,096
  • 4
  • 10
  • 1
    Keenly observed that the OP misstated the shape they were looking for :) However, could you please include more than just the link in your answer? That way if that link ever `404`'s this answer still retains some value. FWIW, "link-only answers" are generally frowned upon and frequently closed. – Alexander Nied Mar 12 '22 at 19:29
  • Thanks for the callout, Alexander. I edit the answer. – Jacob K Mar 12 '22 at 20:27