Xianqiao Wang

Xianqiao Wang

Some records of life and study

  • Home

SVG 文本居中

https://stackoverflow.com/questions/5546346/how-to-place-and-center-text-in-an-svg-rectangle
  1. 设置 的 x, y 属性 // 百分比或者不写单位的 px 值
  2. 设置 text-anchor 属性为 middle // 水平几何中心为文本开始位置
  3. 设置 dominant-baseline 属性为 middle // 基线位置设为垂直中心

Published by Xianqiao Wang on December 13th, 2018

  • Svg
  • RSS

© 2025 Xianqiao's Site.

Design by Fabien Penso. Powered by Postach.io