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.
Asked
Active
Viewed 38 times
0

GOKTU
- 45
- 4
-
1What CSS have you tried? – Andrew Morton Mar 12 '22 at 19:22
-
Is the image in the question what you have or what you want? – Andrew Morton Mar 12 '22 at 19:25
1 Answers
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:
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
-
1Keenly 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
-