How can I clip an image with a custom svg shape in Webflow?
TL;DR
- Create or upload a custom SVG with a single
<path>, and either extract the path or keep it as a file. - Embed the SVG with a
<clipPath>using an Embed element, then applyclip-path: url(#yourClipID);to the image container via custom CSS. - Wrap the image in a div with a unique class, ensure correct sizing, and use
overflow: hiddento finalize clipping.
To clip an image with a custom SVG shape in Webflow, you’ll need to use the CSS clip-path property together with your uploaded custom shape. Webflow doesn’t natively support clip-path control in the UI, so this requires a small custom code embed.
1. Create or Upload Your Custom SVG
- Prepare your SVG shape using a design tool like Figma or Illustrator.
- Make sure the shape is a single
<path>element for simplicity. - Upload the
.svgfile to Webflow in the Assets panel or extract the path directly if you plan to use it inline.
2. Embed the SVG as a Clip Path
- Navigate to the page or component where you want the image clipped.
- Place the Image element in a
divand give that div a unique class (e.g.,custom-clip). - Go to the Page Settings or use an Embed element and paste this inside:
Example:
- Use an SVG
<clipPath>definition inside a<defs>. - Apply the custom style using
clip-path: url(#yourClipID);.
3. Use an Embed Code for Clipping
- Place an Embed element above the image with the custom SVG like:
```
<svg width="0" height="0">
<defs>
<clipPath id="myClip">
<path d="M10,10 ... (your custom path data)" />
</clipPath>
</defs>
</svg>
```
- Then apply the clip using custom CSS in your Page Settings or in the Inside Head tag section:
```
<style>
.custom-clip {
clip-path: url(#myClip);
-webkit-clip-path: url(#myClip);
}
</style>
```
Note: Replace .custom-clip with your actual class name.
4. Adjust Sizing and Positioning
- Ensure the image and the
divhave proper width/height so the clipping appears correctly. - Use
overflow: hiddenif parts of the image extend beyond the clipped path.
5. Use Inline SVG for More Control (Optional)
- Instead of linking an external SVG, insert the full SVG content directly into an Embed, placing the
<image>tag inside the<clipPath>container. - This allows better browser compatibility and simplifies dynamic sizing.
Summary
To clip an image using a custom SVG shape in Webflow, embed the SVG clip path using a <clipPath> element and reference it in a clip-path: url(#id); style targeting your image container. Webflow requires custom Embed elements for this, as there’s no built-in UI support for SVG-based clipping.