Squarespace guide
Version 7.1 · Code block
A quantity calculator in a Squarespace Code block
A Code block writes your HTML straight into the page, so the calculator's frame, its credit line and the script that fits its height all work as written. The one thing to know first is the plan: Squarespace allows iframes and JavaScript in Code blocks on its Core, Plus and Advanced plans.
- Code blockElement
- Runs (HTML mode)Fitting script
- Core, Plus, AdvancedPlans
- 400 KBBlock limit
Before you start
- A Squarespace 7.1 site on the Core, Plus or Advanced plan; the other plans do not run iframes or scripts in a Code block.
- The page open in the editor, with a section where the calculator should go.
- A private browser window for the last check, because code may not show to a logged-in editor.
Step by step
Edit the page
Open the page and click Edit. Hover where the calculator should go and click Add block (or the +).
Choose Code
Pick Code from the block menu. A placeholder block appears in the section.
Open the block's editor
Click the block's pencil icon. Leave the mode on HTML and keep Display Source off; with it on, Squarespace prints the code as text instead of running it.
Paste and apply
Replace the placeholder with the code below, close the editor and resize the block's width in the section grid if you need to.
Save and check logged out
Click Save, then open the page in a private window, or use Preview in Safe Mode, to see the calculator as visitors do.
Your code
<iframe src="https://craftquantities.com/embed/?calc=wallpaper-calculator&ev=1&fmt=compact" width="100%" height="460" loading="lazy" style="border:1px solid #e4e4e7;border-radius:12px;max-width:100%" title="Wallpaper 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/wallpaper-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. The block's limit is 400 KB; this is under 2 KB.
Every other option is in the full builder.
What visitors see
Calculator by Craft Quantities
Sizing the block in a 7.1 section
Squarespace 7.1 places blocks on a grid inside each section: drag the Code block's edges to set how many columns it spans, and the frame inside takes that width. A compact calculator reads well across half to two thirds of a desktop section; the full calculator wants the whole width.
The grid keeps a separate arrangement for phones. Switch the editor to its mobile view and check that the block spans the full width there and that nothing sits on top of it.
Give the block's height room to grow. The fitting script makes the frame taller as the reader opens results, and a block squeezed between two others pushes them down rather than cutting the calculator off.
Troubleshooting
- The code shows as text
- Display Source is switched on in the block's editor. Switch it off and save.
- Nothing shows while I am logged in
- Squarespace may not run a Code block's scripts for a logged-in editor. Use Preview in Safe Mode, or open the page in a private window.
- The block says iframes or scripts are not allowed
- The site's plan does not include them. Iframes and JavaScript in Code blocks need Core, Plus or Advanced.
- It works on the page but not on an index or summary
- Code may not render on index pages or with Ajax loading on. Put the calculator on the page itself, or give the iframe a fixed height and drop the script line.
- The editor freezes after adding the code
- Turn on Disable Scripts in Preview, as Squarespace's Code block help page describes, then edit the block again.
Why it helps
- A wallpaper, tile or paint shop on Squarespace Commerce can answer "how many rolls?" on the page that sells them.
- A designer's or contractor's portfolio gains something useful to do, which keeps a visitor on the site a little longer than a gallery alone.
- The calculator stays current on its own: fixes and new calculators reach your page without editing the block again.
Sources
Checked against these help pages on 26 November 2026.