-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
97 lines (76 loc) · 2.49 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
title: font-size-adjust
slug: Web/SVG/Attribute/font-size-adjust
page-type: svg-attribute
browser-compat: svg.global_attributes.font-size-adjust
---
{{SVGRef}}
The `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.
> [!NOTE]
> As a presentation attribute, `font-size-adjust` can be used as a CSS property. See the CSS {{cssxref("font-size-adjust")}} property for more information.
You can use this attribute with the following SVG elements:
- {{SVGElement("text")}}
- {{SVGElement("textPath")}}
- {{SVGElement("tref")}}
- {{SVGElement("tspan")}}
## Example
```css hidden
html,
body,
svg {
height: 100%;
}
```
```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>
```
{{EmbedLiveSample("Example", "600", "100")}}
## Usage notes
<table class="properties">
<tbody>
<tr>
<th scope="row">Default value</th>
<td><code>none</code></td>
</tr>
<tr>
<th scope="row">Value</th>
<td><code>none</code> | {{cssxref("number")}}</td>
</tr>
<tr>
<th scope="row">Animatable</th>
<td>Yes</td>
</tr>
</tbody>
</table>
- `none`
- : Choose the size of the font based only on the {{ Cssxref("font-size") }} property.
- {{cssxref("<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 {{ Cssxref("font-size") }}.
The number specified should generally be the {{glossary("aspect ratio")}} (ratio of x-height to font size) of the first choice {{ Cssxref("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).
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{cssxref("font-size-adjust")}}