Dark Falcon
Dark Falcon

Reputation: 44181

Raphaël - SVG on top of HTML

I'm making a project which uses HTML elements as nodes in a diagram and uses Raphaël to draw lines between them. The problem is that the lines always wind up underneath the HTML elements. I have tried

raphael.canvas.style.zIndex = 1000;

(which is larger than all my other z-indexes) and also tried placing the SVG canvas as the last element in the DOM with no luck. How can I make these lines be drawn on top?

Upvotes: 0

Views: 2829

Answers (1)

Brian Campbell
Brian Campbell

Reputation: 332776

Have you ensured that your SVG element, and its containing element, are relatively or absolutely positioned? z-index only applies to positioned elements, not elements that have static (the default, in-flow) positioning.

Upvotes: 7

Related Questions