是否可以同时拥有以下元素并使SVG对象覆盖在图像上方(即像是图像的一部分)?
目前它们被显示在图像下方的新行中。
我知道我可以将图像设置为父div的背景图像,但不幸的是,我也需要在父div内旋转它,所以我认为那不是一个选择。
<div id='edit-area' style='position:relative; overflow:none; display:inline-block; border: 1px black solid; width: 950px; height: 500px;'>
<img src='/my_image.png' />
<svg id="edit-svg" height="500" width="950">
<!-- there will be lines, rectangles etc in here -->
</svg>
</div>
<div>
的position: relative
。将<img>
和<svg>
设置为position: absolute
。 - Paul LeBeauposition: absolute;
(在这种情况下为<img>
)的内容制作出来。 - hungerstar