font-size-adjust

Baseline 2024
Newly available

Since July 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Das Attribut font-size-adjust ermöglicht es Autoren, einen Aspektwert für ein Element anzugeben, der die x-Höhe der bevorzugten Schriftart in einer Ersatzschriftart beibehält.

Hinweis: Als Präsentationsattribut hat font-size-adjust auch ein entsprechendes CSS-Eigenschaftspendant: font-size-adjust. Wenn beide angegeben sind, hat die CSS-Eigenschaft Vorrang.

Sie können dieses Attribut mit den folgenden SVG-Elementen verwenden:

Beispiel

html
<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>

Hinweise zur Verwendung

Standardwert none
Wert none | <number>
Animierbar Ja
none

Wählt die Schriftgröße ausschließlich basierend auf der Eigenschaft font-size aus.

<number>

Legt die Schriftgröße so fest, dass die Kleinbuchstaben der Schriftart (bestimmt durch die x-Höhe der Schriftart) die angegebene Zahl mal der font-size beträgt.

Die angegebene Zahl sollte im Allgemeinen dem Seitenverhältnis (Verhältnis von x-Höhe zur Schriftgröße) der bevorzugten font-family entsprechen. Das bedeutet, dass die bevorzugte Schriftart, wenn verfügbar, in Browsern die gleiche Größe aufweist, unabhängig davon, ob sie font-size-adjust unterstützen oder nicht.

0 führt zu Text mit null Höhe (versteckter Text).

Spezifikationen

Specification
CSS Fonts Module Level 4
# font-size-adjust-prop

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
font-size-adjust

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Has more compatibility info.

Siehe auch