Skip to content

Commit 1aab8e0

Browse files
authored
Merge pull request #994 from primer/responsive-line-height
Responsive line-height utilities
2 parents 97a1d0c + 0ac38c2 commit 1aab8e0

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

docs/content/utilities/typography.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ bundle: utilities
88

99
Type utilities are designed to work in combination with line-height utilities so as to result in more sensible numbers wherever possible. These also exist as [variables](/css/support/typography#typography-variables) that you can use in components or custom CSS.
1010

11-
11+
1212

1313
Font sizes are smaller on mobile and scale up at the `md` [breakpoint](/css/support/breakpoints) to be larger on desktop.
1414

@@ -67,7 +67,8 @@ Lighter font-weight utilities are available in a limited range. Lighter font-wei
6767
```
6868

6969
## Line height styles
70-
Change the line height density with these utilities.
70+
71+
Change the line height density with these utilities. Responsive variants are also available (e.g. `.lh-sm-condensed`).
7172

7273
```html live
7374
<p class="lh-default">

src/utilities/typography.scss

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,19 @@
161161
// Close to commonly used line-heights. Most line-heights
162162
// combined with type size equate to whole pixels.
163163
// Will be improved with future typography scale updates.
164-
/* Set the line height to ultra condensed */
165-
.lh-condensed-ultra { line-height: $lh-condensed-ultra !important; }
166-
/* Set the line height to condensed */
167-
.lh-condensed { line-height: $lh-condensed !important; }
168-
/* Set the line height to default */
169-
.lh-default { line-height: $lh-default !important; }
170-
/* Set the line height to zero */
171-
.lh-0 { line-height: 0 !important; }
164+
// Responsive line-height
165+
@each $breakpoint, $variant in $responsive-variants {
166+
@include breakpoint($breakpoint) {
167+
/* Set the line height to ultra condensed */
168+
.lh#{$variant}-condensed-ultra { line-height: $lh-condensed-ultra !important; }
169+
/* Set the line height to condensed */
170+
.lh#{$variant}-condensed { line-height: $lh-condensed !important; }
171+
/* Set the line height to default */
172+
.lh#{$variant}-default { line-height: $lh-default !important; }
173+
/* Set the line height to zero */
174+
.lh#{$variant}-0 { line-height: 0 !important; }
175+
}
176+
}
172177

173178
// Text alignments
174179
// Responsive text alignment

0 commit comments

Comments
 (0)