Skip to content

Commit b71bb2c

Browse files
committed
v5: Add .fs-* utilities for font-size
- Adds new font-sizes Sass map - Generates six new classes for setting only font-size - Updates docs to mention this, including a scss-docs reference
1 parent 1004e3e commit b71bb2c

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

scss/_utilities.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ $utilities: map-merge(
358358
values: $spacers
359359
),
360360
// Text
361+
"font-size": (
362+
property: font-size,
363+
class: fs,
364+
values: $font-sizes
365+
),
361366
"font-weight": (
362367
property: font-weight,
363368
values: (

scss/_variables.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,17 @@ $h4-font-size: $font-size-base * 1.5 !default;
398398
$h5-font-size: $font-size-base * 1.25 !default;
399399
$h6-font-size: $font-size-base !default;
400400

401+
// scss-docs-start font-sizes
402+
$font-sizes: (
403+
1: $h1-font-size,
404+
2: $h2-font-size,
405+
3: $h3-font-size,
406+
4: $h4-font-size,
407+
5: $h5-font-size,
408+
6: $h6-font-size
409+
) !default;
410+
// scss-docs-end font-sizes
411+
401412
$headings-margin-bottom: $spacer / 2 !default;
402413
$headings-font-family: null !default;
403414
$headings-font-style: null !default;

site/content/docs/4.3/utilities/text.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ Transform text in components with text capitalization classes.
6363

6464
Note how `.text-capitalize` only changes the first letter of each word, leaving the case of any other letters unaffected.
6565

66+
## Font size
67+
68+
Quickly change the `font-size` of text. While our heading classes (e.g., `.h1``.h6`) apply `font-size`, `font-weight`, and `line-height`, these utilities _only_ apply `font-size`.
69+
70+
{{< example >}}
71+
<p class="fs-1">.fs-1 text</p>
72+
<p class="fs-2">.fs-2 text</p>
73+
<p class="fs-3">.fs-3 text</p>
74+
<p class="fs-4">.fs-4 text</p>
75+
<p class="fs-5">.fs-5 text</p>
76+
<p class="fs-6">.fs-6 text</p>
77+
{{< /example >}}
78+
79+
Customize your available `font-size`s by modifying the `$font-sizes` Sass map.
80+
81+
{{< scss-docs name="font-sizes" file="scss/_variables.scss" >}}
82+
6683
## Font weight and italics
6784

6885
Quickly change the weight (boldness) of text or italicize text.

0 commit comments

Comments
 (0)