svg写入/识别html元素和css样式
识别html的方法:使用foreignObject 元素嵌套html元素
<foreignObject width="xxx" height="xxx" x="8" y="0">
<body xmlns="http://www.w3.org/1999/xhtml" class="svg-body">
<div class="break-word text-div text-align-center" style="font-weight: xxx; line-height: xxx; font-size: xxx;">xxx</div>
</body>
</foreignObject>
识别css的方法:行内样式或者使用类名定义
.text-div {
height: 100%;
width: 100%;
background-color: #fff;
}
.break-word {
word-break: break-word;
}