Significant whitespace in SVG embedded in HTML
You can use this css property on the text element :
text {
white-space: pre;
}
This works for me in Chrome and Firefox, but not IE9:
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8" /><title>Whitespace in SVG in HTML</title>
</head><body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
<text font-size="10" fill="black">
<tspan dy="10" xml:space="preserve">hi—h i—h i—h i</tspan>
</text>
</svg>
</body></html>
Even the SVG-in-XHTML version doesn't work in IE9:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>Whitespace in SVG in HTML</title>
</head><body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
<text font-size="10" fill="black">
<tspan dy="10" xml:space="preserve">hi—h i—h i—h i</tspan>
</text>
</svg>
</body></html>