score:0

HTML elements (like your select/options input) are positioned using CSS styling -- typically by assigning a "class" (if you want to style several elements the same way), or by "id" (which must be unique within your html document).

So the simplest way to "position" your select list is by including directives like this in the <style> section of your page:

<style>
    #desplegable {
        left: 10px;
        top: 5px;
    }
</style>

Less desirable would be to just include those CSS directives right on the select element itself, using the d3 style(name, value) function:

svg.append("select")
   .attr("id","desplegable")
   .style("left", "10px")
   .style("top", "5px")
   ... etc ...

Generally, trying to pixel position html elements is an exercise in frustration -- for both you and your users with different resolution screens and devices. But if you need to give your element some margins or alignment, there are many css directives that should help you get it looking the way you want.

IMO, The easiest way to try out different styling is to use F12 to open the browser's Dev Console -- when you find the element on the page, use the right-hand list of styles to interactively tweak it...


Related Query

More Query from same tag