SVG文本元素中的制表符宽度

时间:2017-01-02 17:58:30

标签: css svg

考虑这个SVG:

<svg xmlns="http://www.w3.org/2000/svg">
	<defs>
		<style type="text/css"><![CDATA[
			.code {
				font-family: monospace;
				white-space: pre;
				tab-size: 4;
			}
		]]></style>
	</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">
	let r;         
</text>
</svg>

渲染时,您可以看到标签大小明显为1个空格。我怎样才能解决这个问题?我正在使用Chrome,显然支持tab-size

1 个答案:

答案 0 :(得分:1)

SVG有自己的一组CSS属性。不幸的是,tab-size不是其中之一。请参阅:https://www.w3.org/TR/SVG/propidx.html

相关问题