Cra*_*tis 1 svg internet-explorer-11
我需要使用IE11在SVG中将文本元素完美居中。
// SVG代码:
<svg xmlns="http://www.w3.org/2000/svg" width=100% height="100%" viewBox="0 0 130 130">
<circle fill="dodgerblue" cx="50%" cy="50%" r="65"></circle>
<text text-anchor="middle"
alignment-baseline="central"
font-size="75"
font-family="Arial"
x="50%" y="50%">1</text>
</svg>
Run Code Online (Sandbox Code Playgroud)
IE不支持alignment-baseline。实现所需目标的最佳跨浏览器方法是使用dy带小em数值的属性。
dy="0.35"Arial 的周围工程价值。
<svg xmlns="http://www.w3.org/2000/svg" width=100% height="100%" viewBox="0 0 130 130">
<circle fill="dodgerblue" cx="50%" cy="50%" r="65"></circle>
<text text-anchor="middle"
font-size="75"
font-family="Arial"
x="50%" y="50%" dy="0.35em">1</text>
</svg>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1803 次 |
| 最近记录: |