JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://hubblapp.com/campaigns_new/js/html2canvas.js"></script>
<div id="html2canvas">make it canvas</div>
<canvas></canvas>
CSS
#html2canvas{
width:150px;
text-align:center;
padding:30px;
font-weight:bolder;
color:#FFF;
font-size:25px;
background:#000;
}
JavaScript
html2canvas(document.getElementById('html2canvas'), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
window.open(canvas.toDataURL('image/jpeg'));
}
});