Webflow guide

Designer · Code Embed element

A quantity calculator in a Webflow Code Embed

Webflow's Code Embed element puts HTML into the published page, so the frame, the credit line and the script that sizes the frame all work. In the Designer the script is only a placeholder; the calculator comes alive on the published site.

  • Code EmbedElement
  • Runs when publishedFitting script
  • 50,000 charactersElement limit
  • Paid site or workspacePlan

Before you start

  • A paid Site plan, or a Core, Growth, Agency or Freelancer Workspace; Webflow reserves custom code embeds for them.
  • The page open in the Designer, with a container or section where the calculator should sit.
  • The site published at least once, to see the result.

Step by step

  1. Open the Add panel

    In the Designer open the Add panel and scroll to Advanced.

  2. Drag in a Code Embed

    Drag Code Embed onto the canvas, into the section where the calculator belongs. Its code editor opens.

  3. Paste the code

    Paste the code below and click Save & Close. The canvas shows the iframe and a placeholder for the script.

  4. Let it take the width

    Select the embed and give it, or its parent, a width of 100% so the frame follows the column on every breakpoint.

  5. Publish and check

    Click Publish, open the live page and type a measurement: the result updates and the frame grows to fit.

Your code

Code Embed
<iframe src="https://craftquantities.com/embed/?calc=deck-board-calculator&ev=1&fmt=compact" width="100%" height="460" loading="lazy" style="border:1px solid #e4e4e7;border-radius:12px;max-width:100%" title="Deck Board Calculator — Craft Quantities"></iframe>
<p style="margin:4px 0 0;font:12px/1.4 system-ui,sans-serif">Calculator by <a href="https://craftquantities.com/calculators/renovation-construction/deck-board-calculator/">Craft Quantities</a></p>
<script>(function(){if(window.cqEmbedFit)return;window.cqEmbedFit=1;window.addEventListener("message",function(e){var d=e.data;if(!d||d.source!=="craft-quantities"||d.type!=="size"||typeof d.height!=="number"||!isFinite(d.height))return;var f=document.getElementsByTagName("iframe");for(var i=0;i<f.length;i++){if(f[i].contentWindow!==e.source)continue;var a=document.createElement("a");a.href=f[i].src;if(a.protocol+"//"+a.host!==e.origin)return;f[i].style.height=Math.min(6000,Math.max(200,Math.ceil(d.height)))+"px";return}})})();</script>

The frame, the credit line and the fitting script, well under the element's 50,000-character limit.

Every other option is in the full builder.

What visitors see

Your Webflow page · Projects · Decking

Calculator by Craft Quantities

Checking every breakpoint

Webflow styles the largest breakpoint first and passes those styles down to tablet and the two mobile sizes. A width set in pixels on the desktop view therefore follows the embed to a phone, where it overflows; a width of 100% does not.

Click through each breakpoint in the Designer's top bar with the embed selected. The calculator itself is not drawn on the canvas, so look at the box the embed occupies: full column width, no fixed height, no overflow hidden on its parents.

On the published page the frame stacks its inputs on narrow screens and grows; the fitting script follows it, so no breakpoint needs a height of its own.

Troubleshooting

The calculator is not in the Designer
Expected: Webflow shows scripts as placeholders on the canvas and runs them only on the published site. Publish and check the live page.
The frame stays at its first height
Check the site's publishing options: loading JavaScript asynchronously can delay scripts. Or set the iframe's height to the size you need.
The frame is wider than the phone
The embed or its parent has a fixed width. Set it to 100% at the smaller breakpoints.
Webflow will not save the embed
The site's plan does not include custom code. Move to a paid Site plan or a qualifying Workspace.

Why it helps

  • Studios and builders who design in Webflow can add a working estimate tool to a project page without writing one.
  • The frame inherits nothing from your styles and changes none of them, so it cannot break the design around it.
  • Readers get quantities in metric and imperial, with the method one click away through the credit link.

Sources

Checked against these help pages on 26 November 2026.

  1. Webflow Help Center: Custom code embed
  2. Webflow University: Custom code embed (video)
  3. Webflow Help Center: Advanced publishing options