The
clip-path
CSS property property creates a clipping region that sets what part of an element should be shown. Parts that are inside the region are shown, while those outside are hidden.
In the TripTime project, I made a polygon effect for small screen views of the landing page:
I achieved this by adding a pseudo-element with border
property:
1 | .introRight { |
Now I learnt that I could also achieve this shape through:
1 | .introRight { |
With the polygon
type, give a bunch of x-y coordinates. These specify position relative to the element itself, starting from the left top corner as (0, 0).
Other options available for clip-path
can be found at the MDN page