SVGテキストの周りに境界線を置こうとすると、結果が変化します。SVGテキストの周りの矩形の境界線
HTML:(ミュートクラスで)
<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));
})
我々はミュートクラス
X
を持っています
ここでは、ミュートクラスで
X
を持っていますが、国境
なしこれは、我々が
ノートのように見えるように境界線を取得しようとしているものである:その親がグループではなく、HTML要素です。
JSフィドル:あなたが発見したとして http://jsfiddle.net/chrisfrisina/yuRyr/5/
[この質問](http://stackoverflow.com/質問/ 13217669/svg-image-with-border-stroke)と[この質問](http://stackoverflow.com/questions/3001950/how-can-i-draw-a-box-around-text- with-svg)が役立つはずです。 –