Blogger guide

HTML/JavaScript gadget · HTML view

A quantity calculator in a Blogger post or sidebar

Blogger takes HTML in two places: inside a single post, from the editor's HTML view, and on every page at once, from an HTML/JavaScript gadget in the layout. Both write the code into the page, so the frame fits its own height.

  • Gadget or postWhere
  • RunsFitting script
  • AutomaticHeight
  • FreeBlogger plan

Before you start

  • Admin or author access to the blog in Blogger.
  • For a sidebar: the mini format fits a 250–350 px column; make it in the full builder.
  • For a post: the editor switched to its HTML view while you paste.

Step by step

  1. In a post: open the HTML view

    Open the post in the editor and switch from compose to HTML view with the toggle at the top left.

  2. Paste where it belongs

    Find the paragraph the calculator should follow and paste the code on a new line after its closing </p>. Then Update or Publish.

  3. Or in the sidebar: add a gadget

    In the blog's menu open Layout, click Add a Gadget in the sidebar area, and choose HTML/JavaScript.

  4. Paste into Content

    Give the gadget a title if you want one, paste the code into Content, and click Save.

  5. Check the blog

    Open the post or the home page in a private window and try a measurement.

Your code

Post HTML view or HTML/JavaScript gadget
<iframe src="https://craftquantities.com/embed/?calc=mulch-calculator&ev=1&fmt=compact" width="100%" height="460" loading="lazy" style="border:1px solid #e4e4e7;border-radius:12px;max-width:100%" title="Mulch 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/landscaping-outdoor/mulch-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. For a sidebar, choose the compact format here or the mini format in the full builder.

Every other option is in the full builder.

What visitors see

Your blog · Garden projects · Spring mulching

Calculator by Craft Quantities

In a post or in the sidebar?

In a post, the calculator answers that post's question ("how much mulch for this bed?") and appears only there. Choose the calculator that matches the article.

In the sidebar, one gadget puts the calculator on every page of the blog. That suits a blog that keeps returning to one job, a gardening blog and mulch, a renovation diary and paint; the mini format is made for that width.

Troubleshooting

Blogger will not save the post
The HTML view found an error in the post's code. Check that nothing was pasted inside another tag, or dismiss the warning if the code is exactly as copied.
The code changed after switching back to compose
Paste and publish from the HTML view; switching views can rewrite pasted markup.
The sidebar frame is too wide
Use the mini format, which is built for a 250–350 px column, from the full builder.
The frame does not grow
The fitting script line was left out. Paste the whole code, or set a larger height on the iframe.

Why it helps

  • A DIY or garden blog's how-to post ends with a working answer to the reader's own job, not just the writer's.
  • Readers spend longer on the post, and the credit line sends the ones who want the method to a page that cites its sources.
  • No ads, no cookies and no tracking come with the frame, so it does not compete with your own ads or analytics.

Sources

Checked against these help pages on 26 November 2026.

  1. Blogger Help: Add or remove gadgets (HTML/JavaScript)
  2. Blogger Help: Edit HTML in a post