1
0
mirror of https://github.com/google/fonts.git synced 2024-12-19 06:41:31 +03:00
fonts/cc-by-sa/knowledge/glossary/terms/width_axis/content.md
repeatdailystudio 4cc54f42f4
Update content.md
slight rewording for clarity
2022-03-31 19:24:15 -04:00

1.7 KiB
Raw Blame History

"Width" (wdth in CSS) is an axis found in some variable fonts. It controls the font files width parameter.

The Google Fonts CSS v2 API defines the axis as:

Default: Min: Max: Step:
100 25 200 0.1

Two side-by-side type specimens of the word “spacious”, each shown with a variable axis represented beneath as a horizontal slider. The first specimen, with the slider most of the way to the left to represent a lower value on the axis, shows a very condensed version, taking up very little horziontal space. The second specimen, with the slider most of the way to the right to represent a higher value on the axis, is very wide.

Width is the result of how much horizontal space is taken up by a typefaces characters. A condensed face takes up considerably less space than a wide one.

In CSS, we can assign a variable width to an element of our choosing using the font-stretch property. (Despite the name, note that the type is never literally “stretched” by browsers. This property name was chosen to make the concept more accessible to a general audience.)

p {
  font-stretch: 50%;
}
strong {
  font-stretch: 193%;
}

Here, our text will be quite narrow—the type designer has set 50% as half of the regular (100%) width—and the strong text will be almost twice the width of the regular. Width values are always above 0, with 100% being the regular width.