是否可以强制html canvas标签显示孩子? [英] Is it possible to force the html canvas tag to display children?
本文介绍了是否可以强制html canvas标签显示孩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上正如我问。我希望以下工作:
Basically exactly as I asked. I'd like the following to work:
<canvas width="100" height="100" style="position: relative">
<div style="border: 1px solid black; width: 50px; height: 50px; position: absolute; left: 10px; top: 10px"></div>
</canvas>
我意识到canvas标签的内容通常只显示为fallback,
I realize that the contents of the canvas tag are usually only displayed as fallback, but I'd like to display the contents always.
推荐答案
是否有办法强制显示这些内容? >
不,不是以可移植的方式工作。
No, not in a way that works portably.
但是,你可以很容易地用一点javascript来定位div在画布的坐标。
However, you can position the div on the coordinates of the canvas quite easily with a bit of javascript.
这篇关于是否可以强制html canvas标签显示孩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文