就业培训     下载中心     Wiki     联络
登录   注册

Log
  1. 首页
  2. SVG:可伸缩向量图形
  3. SVG Attribute reference
  4. font-size-adjust

内容表

  • 范例
  • 用法注意事项
  • 规范
  • 浏览器兼容性
  • 另请参阅

font-size-adjust

font-size-adjust attribute allows authors to specify an aspect value for an element that will preserve the x-height of the first choice font in a substitute font.

注意: As a presentation attribute, font-size-adjust can be used as a CSS property. See the css font-size-adjust property for more information.

You can use this attribute with the following SVG elements:

  • <altGlyph>
  • <text>
  • <textPath>
  • <tref>
  • <tspan>

范例

html, body, svg {
  height: 100%;
}

								
<svg width="600" height="80" viewBox="0 0 500 80"
    xmlns="http://www.w3.org/2000/svg">
  <text y="20" font-family="Times, serif" font-size="10px">
    This text uses the Times font (10px), which is hard to read in small sizes.
  </text>
  <text y="40" font-family="Verdana, sans-serif" font-size="10px">
    This text uses the Verdana font (10px), which has relatively large lowercase letters.
  </text>
  <text y="60" font-family="Times, serif" font-size="10px" font-size-adjust="0.58">
    This is the 10px Times, but now adjusted to the same aspect ratio as the Verdana.
  </text>
</svg>

								

用法注意事项

默认值 none
值 none | <number>
Animatable Yes
none

Choose the size of the font based only on the font-size 特性。

<number>

Choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size .

The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family . This means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust .

0 yields text of zero height (hidden text).

规范

规范 状态 注释
CSS Fonts Module Level 3
The definition of 'font-size-adjust' in that specification.
推荐 无变化
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'font-size-adjust' in that specification.
推荐 初始定义

浏览器兼容性

BCD tables only load in the browser

另请参阅

  • css font-size-adjust

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide .

最后修改: Sep 23, 2021 , 由 MDN 贡献者

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1