Provare a mettere un bordo attorno al testo SVG e ottengo risultati diversi.Bordo rettangolare intorno al testo SVG
HTML: (con la classe mute)
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<text x="37.5" y="37.5" class="ablate-x mute">X</text>
</svg>
CSS:
.ablate-x {
font-size: 24px;
color: gray;
opacity: 0.5;
font-weight: 900;
cursor: hand;
cursor: pointer;
}
.mute {
opacity: 1;
fill: red;
stroke: red;
stroke-width: 2px;
/* we tried border: 2px solid red; but it didn't work */
}
d3.js:
.on("click", function(d) {
var selection = d3.select(this);
selection.classed("mute", (selection.classed("mute") ? false : true));
})
Qui abbiamo la X
senza la classe mute
Qui abbiamo la X
con la classe mute ma senza confine
Questo è ciò che stiamo cercando di raggiungere il confine a guardare come
Nota: suo padre è un gruppo, non un elemento HTML.
JS Fiddle: http://jsfiddle.net/chrisfrisina/yuRyr/5/
[Questa domanda] (http://stackoverflow.com/ domande/13217669/svg-image-with-a-border-stroke) e [questa domanda] (http://stackoverflow.com/questions/3001950/how-can-i-draw-a-box-around-text- with-svg) dovrebbe aiutare. –