Skip to content

Commit 7184dd2

Browse files
authored
Merge pull request #752 from tailwindcss/use-better-mono-font-for-code-elements
Use configured monospace font for monospace elements
2 parents 7c61afa + 87cf9df commit 7184dd2

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

__tests__/fixtures/tailwind-output-important.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,20 @@ strong {
527527
font-weight: 700;
528528
}
529529

530+
/**
531+
* Use the configured 'mono' font family for elements that
532+
* are expected to be rendered with a monospace font, falling
533+
* back to the system monospace stack if there is no configured
534+
* 'mono' font family.
535+
*/
536+
537+
pre,
538+
code,
539+
kbd,
540+
samp {
541+
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
542+
}
543+
530544
.container {
531545
width: 100%;
532546
}

__tests__/fixtures/tailwind-output.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,20 @@ strong {
527527
font-weight: 700;
528528
}
529529

530+
/**
531+
* Use the configured 'mono' font family for elements that
532+
* are expected to be rendered with a monospace font, falling
533+
* back to the system monospace stack if there is no configured
534+
* 'mono' font family.
535+
*/
536+
537+
pre,
538+
code,
539+
kbd,
540+
samp {
541+
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
542+
}
543+
530544
.container {
531545
width: 100%;
532546
}

src/plugins/css/preflight.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,17 @@ textarea {
172172
strong {
173173
font-weight: theme('fontWeight.bold', bolder);
174174
}
175+
176+
/**
177+
* Use the configured 'mono' font family for elements that
178+
* are expected to be rendered with a monospace font, falling
179+
* back to the system monospace stack if there is no configured
180+
* 'mono' font family.
181+
*/
182+
183+
pre,
184+
code,
185+
kbd,
186+
samp {
187+
font-family: theme('fontFamily.mono', SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
188+
}

0 commit comments

Comments
 (0)