我开始尝试使用 SVG,但我不确定这是我做错了什么、它不受支持还是只是 Firefox 的一个错误。
这是 SVG 中的行
<text x="177" y="658">Web Interactive</text>
这些是样式
svg text{
position:relative;
font-size:7.3em;
font-family:'GothamBookRegular',Helvetica,Arial,sans-serif;
font-variant:normal;
font-style:normal;
text-transform:uppercase;
text-align:left;
fill:#282828;
color:#282828;
}
这适用于 Opera、Chrome、IE9 和 Safari。我还测试了 letter-spacing
,它适用于除 Firefox 之外的所有平台。
最佳答案
你不能使用css,但你总是可以使用javascript。如果您希望所有 svg 文本元素都大写。在我的例子中,它在文本元素中有 tspan 元素,所以这是我的 (jquery) 代码:
$('svg text tspan').each( function (){
txt = $(this).text().toUpperCase();
$(this).text(txt);
})
关于html - 为什么在 Firefox 中文本转换对 SVG 文本不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8825098/