我使用rasterizeHTML
libary将html渲染到画布,但我无法绘制正确的html / css。它忽略了External CSS
,它的渲染html不是css吗?你能帮忙解决这个问题吗?
var canvas = document.getElementById("canvas"),
html_container = document.getElementById("thehtml"),
html = html_container.innerHTML;
rasterizeHTML.drawHTML(html, canvas);

* {
font-size: 25px;
margin: 0;
}
.test {
color: green;
border: 2px dashed blue;
padding: 10px;
}

<canvas id="canvas" width="300" height="200" style="border: 1px solid black;"></canvas>
<div id="thehtml" style="display: none;">
<div class="test">Some example HTML</div>
</div>
&#13;