标签宽度
问题描述:
考虑这个SVG:标签宽度
<svg xmlns="http://www.w3.org/2000/svg">
\t <defs>
\t \t <style type="text/css"><![CDATA[
\t \t \t .code {
\t \t \t \t font-family: monospace;
\t \t \t \t white-space: pre;
\t \t \t \t tab-size: 4;
\t \t \t }
\t \t ]]></style>
\t </defs>
<text class="code" fill="black" font-size="16" x="0" y="16">
{
</text>
<text class="code" fill="black" font-size="16" x="0" y="32">
\t let r;
</text>
</svg>
呈现时,你可以看到,标签尺寸显然是1米的空间。我怎样才能解决这个问题?我使用的Chrome显然支持tab-size
。
答
SVG拥有自己的一组CSS属性。不幸的是,制表符不是其中之一。请参阅:https://www.w3.org/TR/SVG/propidx.html
+0
它在Firefox中使用'-moz-tab-size' ... – 2017-01-02 19:24:44
您需要分别为firefox和opera添加供应商特定标签'-moz','-o'。 '-moz-tab-size:4;''-o-tab-size:4;' – pol