svg 文字_SVG文字简介

svg 文字

SVG text has some significant limitations compared to HTML content… but it also has some very real advantages in particular use-cases, and can sometimes be the only way to solve certain text layout challenges on web pages.

HTML内容相比,SVG文本具有一些明显的局限性……但是在特定的用例中它也具有一些非常实际的优势,并且有时可能是解决网页上某些文本布局挑战的唯一方法。

SVG文本作为布局 (SVG Text as Layout)

doesn’t think of text as does: that is, as a string of glyphs to be wrapped and styled inside a container. Rather, it thinks of text as a graphical element to be laid out much like everything else: text should have at least a y coordinate value and a font-size to place and scale it in the viewBox area:

不会像那样考虑文本:也就是说,它是一串在容器内包装和样式化的字形字符串。 相反,它将文本视为要像其他所有内容一样布局的图形元素:文本应至少具有y坐标值和font-size以将其放置在viewBox区域中并缩放。

<svg xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 500 80">
    <text y="60" font-size="55" font-weight="bold" 
    font-family="Avenir, Helvetica, sans-serif">
        SEVEN NATION ARMY
    </text>
</svg>

font-size is assumed to be in pixels, relative to the viewBox

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值