 <p>Values of <code>background-size</code> property should be like <code>Xpx Ypx</code>. Try change Your last line to this:</p> <pre><code>t.getBody().style.backgroundSize = newWidth+"px "+newHeight+"px"; </code></pre>