How to replicate shapes using clip-path or other things

Hello, I want to replicate the "trapeziums", the purple and black one and I don't really know how to proceed, I do have an idea, like I know to have custom shapes, we use clip-path something like that? Would really appreciate if someone can elaborate on that and give ideas on how I can try to replicate the "trapeziums"
No description
15 Replies
Jochem
Jochemβ€’5mo ago
CSS Clip-Path Generator - CSS Portal
This online generator helps with creating shapes for images using the css clip-path property.
Faker
FakerOPβ€’5mo ago
oh thanks, will have a look at we even have an animation generator, didn't know that, is it useful ? Like can we do complex things with that?
Jochem
Jochemβ€’5mo ago
it really depends on the generator if you can do complex things with it but it can definitely be useful if you don't feel like writing them by hand
Faker
FakerOPβ€’5mo ago
yep I see, thanks !
Faker
FakerOPβ€’5mo ago
Small question, this is what I have achieved using clip-path. When I try to resize my viewport width, like shrinking things, what happen is at a certain point their is some "gap" appearing in the middle, like separating shape1 and shape2, see the second diagram. Is there any reason to that? https://codepen.io/Fakeur/pen/YPXqjBg
Fakeur
CodePen
Untitled
...
No description
No description
StefanH
StefanHβ€’5mo ago
Looks like anti-aliasing artifacts. I wouldn't stack two boxes next to each other but rather on top of each other. Have a black background div and then stack another div with the same width and height on top. That one then has the clip path to cut out the shape you need and the purple background color You can stack them with grid or position: absolute , whatever you prefer You can then use percentage values on the clip path if you want the shape to scale with the width of the rectangle. Or you use fixed values like rem to have it always at the same width, anchored to the left That'll also make it easier to add the angled border. Just stack another div between the two and make the clip path extend to the right a bit Aha i just saw that you have the black stuff on top and purple on the bottom. I'd invert that. Black backdrop with purple overlay Putting two same colored boxes next to each other like that sometimes has bleedthrough like that
Chooβ™šπ•‚π•šπ•Ÿπ•˜
The main problem is that the black section is comprised of two shapes next to each other. It is entirely possible to make them one shape.
Chooβ™šπ•‚π•šπ•Ÿπ•˜
I didn't use exact numbers to replicate what you had. This just shows the principle.
Chris Bolson
Chris Bolsonβ€’5mo ago
Whilst I realize that you want to to this with clip-path, you could also create the same effect using a linear-gradient background. https://codepen.io/cbolson/pen/WbvGEOx
Faker
FakerOPβ€’5mo ago
I will have a look, thanks ! yeah the one you create seems to work, hmm what was wrong with mine? Like me i had a main wrapper and 2 div inside but I think you only have a main wrapper and a single shape. The middle vertical line is a normal thing whenever we have 2 different divs with different background color next to each other ? Why the line don't appear in the one you draw pls
Chooβ™šπ•‚π•šπ•Ÿπ•˜
The line you get is the gap between your two shapes. I have one shape, so there can't be a gap.
Faker
FakerOPβ€’5mo ago
yep I see, thanks ! So, it's normal then in any design? if we have 2 shapes with 2 different background we are expected to have a line like that ?
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Yes. It happens at some levels of magnification. It's better to not put two shapes next to each other if they should actually be one.
Faker
FakerOPβ€’5mo ago
yep I see, thanks !

Did you find this page helpful?