1. Clip Paths
Clip paths allow you to "clip" elements into a shape, represented in CSS with the
ellipse functions. For example:
Clip paths are written with the
clip-path property for clipping element content, or the
background-clip property for clipping element backgrounds.
polygon function is one of the most common for clipping, and is composed of a list of points (vertices). Each point is written as
0 0 would signify the top left, whereas
100% 100% would signify the bottom right. The example above uses a point on the bottom right that is not fully at the bottom (only 85%), producing a diagonal effect.
Clip paths are especially popular in flat design for creating slanted areas as shown in the example. I use this on my personal website at xtrp.io to draw attention to background images in certain pages.
Basic clip-path usage is supported in all major browsers except Edge and IE: see CanIUse Data for Clip Paths.
You can create your own clip-paths yourself, or you can use a tool like Clippy to automatically generate clip path CSS for you.
2. Blend Modes
Blend modes allow you to blend an element's content with its parent element(s) or its background using specific methods.
Let's say you were trying to overlay a yellow color over a background image. Ordinarily:
In this case, the yellow color and the image were simply added together to create final result. However, if we wanted to blend the yellow into the image instead of adding it, we could use a blend mode called
Blend modes are specified in backgrounds with the
background-blend-mode property, and in elements (for blending with backgrounds or parents) with the
Possible blend modes include:
difference, and more. More information on possible blend modes and their effects can be found here on the MDN web docs.
Blend modes are supported in all major browsers except Edge and IE: see CanIUse Data for Background Blend Modes.
3. CSS Filters
CSS filters provide a vast array of options for filtering elements visually. For example:
Other filters include:
grayscale, and more.
CSS filters have a vast variety of uses, for example: CSS filters have become popular in creating a dark mode effect on sites using the
filter property is supported in all major browsers except IE: see CanIUse Data for CSS Filters.
Thanks for reading!
I hope you enjoyed this post, and found some of the CSS features mentioned to be useful.
— Gabriel Romualdo, January 3, 2019