Cross-Browser SVG Text Baseline Alignment

前提是你 提交于 2020-01-16 18:16:20

问题


This is how SVG text is rendered in browser for Chrome with the following (note in react so camel case attributes)

            <text x="50%" y="50%"
                    className='middleText'
                    textAnchor="middle"
                    alignmentBaseline="middle"
                    >{style.displayVal.toFixed(precision)}</text>

This is how the text renders in Firefox:

What is the best way you've found to get consistent baseline crossbrowser?


回答1:


replace alignmentBaseline with dominantBaseline.

Firefox does not currently support the former property but does support the latter.



来源:https://stackoverflow.com/questions/51090439/cross-browser-svg-text-baseline-alignment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!