question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with background images

See original GitHub issue

Hi, guys!

Thanks for your work, h2c is an awesome tool! I have one small issue on page: http://king.fi/site/ - background image from body { … background: #070707 url(…/img/bg.jpg) no-repeat 50% 0; doesn’t render. With simple calling of h2c:

html2canvas($('body'), {
            allowTaint: false,
            logging:true,
            onrendered: function (canvas) {
                document.body.appendChild(canvas);
            }
        });

and with your test console http://html2canvas.hertzen.com/screenshots.html I have the same results:

Original: screen shot 2013-09-04 at 5 33 03 pm

Rendered: screen shot 2013-09-04 at 5 33 11 pm

html2canvas: 0.4.0 MacOs 10.6 Chrome 29.0.1547.62

Thanks!

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:56 (21 by maintainers)

github_iconTop GitHub Comments

26reactions
fperichcommented, Mar 6, 2014

i could not render background images and it seemed to be cover or contain background size, so i’ve changed line 350 in 0.4.1 version to:

topPos = isNaN(parseInt(bgposition[1], 10)) ? topPos : parseInt(bgposition[1], 10);

and it works!

5reactions
fxmontignycommented, Aug 22, 2017

Hi @gopiss,

Use corse option.

html2canvas(document.body, {
            onrendered: function (canvas) {
.....
            },
            useCORS: true
        });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix CSS background-image not working | HTML/CSS
1. Check that your CSS file is linked correctly in your HTML file. · 2. Make sure the image path is set correctly...
Read more >
CSS Background image not loading
Try [CTRL] + [F5] to hard refresh the page within the browser. Maybe it's just a caching problem. And like Nikhil said: search...
Read more >
Problem with background-image (resolved)
Anyone ever had a problem with the background image on a header disappearing when you add no-repeat? So,
Read more >
CSS Background Image Not Working
CSS Background Image Not Working: How to Resolve and Avoid Bugs · Make Sure Your CSS File Is Properly Embedded in Your HTML...
Read more >
Background image problems! - HTML & CSS
Hi Im new to web coding, I have read through the Build your own website book but now im stuck on my own...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found