简体   繁体   English

不能更改js节点文本的颜色

[英]can't change colour of js node text

Why can't I adjust the css colour of the text in this tree? 为什么我不能调整该树中文本的CSS颜色? it allows me to change the text size but I can't seen to change anything like font colour or background colour 它允许我更改文本大小,但看不到更改字体颜色或背景颜色的任何内容

FIDDLE 小提琴

.node text {
      font: 12px sans-serif;  
}

On svg text nodes, you'll have to use fill instead of color : svg text节点上,您必须使用fill而不是color

 .node text { font: 12px sans-serif; fill: red; } 
 <svg width="960" height="500"> <g transform="translate(100,20)"> <g class="node" transform="translate(0,10)"> <text x="-13" dy=".35em" text-anchor="end" style="fill-opacity: 1;">Product</text> </g> </g> </svg> 

Fiddle 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM