【问题标题】:How do I use javascript to set the glyph-orientation-horizontal property on an svg text element?如何使用 javascript 在 svg 文本元素上设置 glyph-orientation-horizo​​ntal 属性?
【发布时间】:2014-07-14 01:25:37
【问题描述】:

如何使用 javascript 设置 svg 文本元素的 glyph-orientation-horizo​​ntal 属性?

我试过了

svg.setAttribute("style","glyph-orientation-horizontal:90"); 也试过 svg.style.glyph-orientation-horizontal=90;

第一个清除所有样式值,以便 style='' 第二个抛出 javascript 错误

svg 定义为 var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");

我是否需要单独设置容器 svg 的所有子文本元素的值?或者我可以在容器 svg 上设置值并且文本元素将继承该值?

任何建议将不胜感激。

谢谢, 克里斯托弗

【问题讨论】:

    标签: javascript html css text svg


    【解决方案1】:

    连字符变成驼峰式:

    svg.style.glyphOrientationHorizontal = 90
    

    【讨论】:

    • 啊……很高兴知道。完美运行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-28
    • 1970-01-01
    • 2014-02-07
    • 2016-09-11
    • 2011-08-27
    • 2021-05-16
    相关资源
    最近更新 更多