I recently learned about the clip-path property in CSS3.
The clip-path creates a clipping region that sets what part of an element should be shown.
This can help in creating really cool slanted Hero sections. The following CSS code snippet will create a slanted hero background section.
clip-path: polygon(0 0, 100% 0, 100% 75vh, 0 100%);
The polygon shape takes 4 values in a pair of (x y) each for top-left, top-right, bottom-right, and bottom-left.
But sometimes it can be very tricky to create a clipping path. So, here is a really cool tool for generating a CSS clip-path.
https://bennettfeely.com/clippy/
Now, go and create your own clip designs, shapes, and backgrounds.
If you enjoyed reading this little CSS tip then, join my newsletter here. There I share more amazing stuff on web-development.
Thanks a lot for reading.
Top comments (2)
Honestly, with that title, I was kinda hoping for an explanation and examples instead of a tool that does it for you.
Thanks for the feedback @shikkaba
I will surely update the post with better explanation and examples.