Reputation: 2756
I want to preserve the white space in a single SVG < text> element.
This works fine with xml:space="preserve" attribute in the text element in all but IE browser.
<text x="0" y="15" fill="red" xml:space="preserve">I love SVG!</text>
Here is the jsfiddle, try to open this fiddle in Chrome/Firefox and in latest IE, notice that whitespace in the text element text is not preserved in IE.
Any workaround so that this works in IE as well?
Upvotes: 11
Views: 10848
Reputation: 124089
I guess you could replace each space by  
(that's the unicode non-breaking space character).
In javascript it would be written as \u00A0 though.
Upvotes: 24