How to position HTML DIV elements relative to SVG elements?
I used D3 to generate the SVG chart:
I want to add a dropdown next to the legend in the lower right corner. I do have the corresponding element (a regular HTML DIV element), but I don't know how to position it correctly on the chart.
I understand positioning of SVG elements, but I don't know how to apply something like a DIV element.
Any ideas other than placing it outside the viewport (like below)?
ViewCSS Location. You can create a relatively positioned DIV to hold your SVG. You can then place an absolutely positioned DIV on top of it to accommodate the
select
element; you can use itsleft
andtop
styles to position the second DIV Place anywhere you want.Everything put together: