Line Height
Line height utilities set line-height. They are separate from size: change the
size, then choose the leading that fits it.
Classes
Section titled “Classes”| Class | line-height |
|---|---|
line-height-1 |
1 |
line-height-25 |
1.25 |
line-height-50 |
1.5 |
line-height-75 |
1.75 |
line-height-2 |
2 |
Compact aliases: leading-none, leading-tight, leading-snug,
leading-normal, leading-relaxed, leading-loose.
<h2 class="line-height-25">Tight heading</h2><p class="line-height-75">Comfortable long-form copy</p>The class reads --line-height:
<p class="line-height-50" style="--line-height: 1.6">One-off leading</p>Responsive line height
Section titled “Responsive line height”<p class="line-height-75 line-height-md-50">Tighter once there is room</p>Responsive: line-height-sm-25 … line-height-2xl-2.
These classes are in the separate responsive module: import
nightcss/utilities/responsive after the base bundle, or use
nightcss/full.
Choosing a value
Section titled “Choosing a value”- Display and headings:
1–1.25. - UI labels and short paragraphs:
1.25–1.5. - Long-form body copy:
1.5–1.75.
Very large text needs tighter leading than body copy; the default browser line
height is usually too loose above 2rem. See Type Scale for
the size steps.
Use in CSS
Section titled “Use in CSS”The class is the markup shorthand. The same style in a component stylesheet:
.heading { line-height: 1.25;}.copy { line-height: var(--nc-leading-relaxed);}The Sass subpackage exposes the same values: nc.nc-line-height(25) and
nc.nc-leading("relaxed"). See Sass subpackage.
A breakpoint is the same declaration inside a media query; you do not need a second class.