view project
From the Archives

HTML Picture Element in Webflow

Ayk Martirosyan

2026 Update: I’ve moved from Webflow to building with AI. Read why I switched to Claude Code, or learn to do it yourself.

Sometimes you want to use different images for the same section/element in different breakpoints. For example, a landscape image for the desktop breakpoint, and a portrait image for the mobile breakpoint.

There are two solutions to this problem.

The first solution is to adjust the image wrapper size and set the image to cover the wrapper.

The second solution is to use an html picture element where you can specify images for any breakpoints you want.

Until now, Webflow didn’t support the picture element. Now we can use the custom DOM element and use it as a picture element.

  1. Create a custom DOM element and give it a picture tag.

  2. Create another custom element inside the picture element and set its tag to source.

  3. Specify the breakpoint attribute media=“(max-width: 478px)” for mobile and media=“(max-width: 991px)” for tablet. You need a source element for each breakpoint you want to set a specific image for.

  4. For each source element add a srcset attribute with the image URL you want to use.

  5. Add the default image. In my case, it’s the desktop image.

A screenshot of html picture element in Webflow interface.

Images with different sizes and proportions for different breakpoints.

An image showing how to create an html picture element in Webflow.

An image showing how to create a source tag for the html picture element in Webflow.

An image showing the default image in the html picture element in Webflow.

THE FIRST STEP

Book your complimentary Diagnostic Session

In 30 minutes, we will diagnose the single biggest bottleneck in your Client Acquisition Engine and outline a clear path to fix it.

You're either relying on hope and referrals, or you're burning out on random acts of marketing. Both paths lead to an unpredictable business. The solution is not more tactics; it's a better engine.