Skip to content

Commit 9585ae1

Browse files
authored
Don't explicitly set font/line-height on body, inherit from html instead (#2729)
1 parent f82cab1 commit 9585ae1

5 files changed

+56
-5
lines changed

__tests__/fixtures/tailwind-output-flagged.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,21 @@ ul {
361361
* to override it to ensure consistency even when using the default theme.
362362
*/
363363

364-
html, body {
364+
html {
365365
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */
366366
line-height: 1.5; /* 2 */
367367
}
368368

369+
/**
370+
* Inherit font-family and line-height from `html` so users can set them as
371+
* a class directly on the `html` element.
372+
*/
373+
374+
body {
375+
font-family: inherit;
376+
line-height: inherit;
377+
}
378+
369379
/**
370380
* 1. Prevent padding and border from affecting element width.
371381
*

__tests__/fixtures/tailwind-output-important.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,21 @@ ul {
361361
* to override it to ensure consistency even when using the default theme.
362362
*/
363363

364-
html, body {
364+
html {
365365
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */
366366
line-height: 1.5; /* 2 */
367367
}
368368

369+
/**
370+
* Inherit font-family and line-height from `html` so users can set them as
371+
* a class directly on the `html` element.
372+
*/
373+
374+
body {
375+
font-family: inherit;
376+
line-height: inherit;
377+
}
378+
369379
/**
370380
* 1. Prevent padding and border from affecting element width.
371381
*

__tests__/fixtures/tailwind-output-no-color-opacity.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,21 @@ ul {
361361
* to override it to ensure consistency even when using the default theme.
362362
*/
363363

364-
html, body {
364+
html {
365365
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */
366366
line-height: 1.5; /* 2 */
367367
}
368368

369+
/**
370+
* Inherit font-family and line-height from `html` so users can set them as
371+
* a class directly on the `html` element.
372+
*/
373+
374+
body {
375+
font-family: inherit;
376+
line-height: inherit;
377+
}
378+
369379
/**
370380
* 1. Prevent padding and border from affecting element width.
371381
*

__tests__/fixtures/tailwind-output.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,21 @@ ul {
361361
* to override it to ensure consistency even when using the default theme.
362362
*/
363363

364-
html, body {
364+
html {
365365
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */
366366
line-height: 1.5; /* 2 */
367367
}
368368

369+
/**
370+
* Inherit font-family and line-height from `html` so users can set them as
371+
* a class directly on the `html` element.
372+
*/
373+
374+
body {
375+
font-family: inherit;
376+
line-height: inherit;
377+
}
378+
369379
/**
370380
* 1. Prevent padding and border from affecting element width.
371381
*

src/plugins/css/preflight.css

+12-1
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,22 @@ ul {
6262
* to override it to ensure consistency even when using the default theme.
6363
*/
6464

65-
html, body {
65+
html {
6666
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 1 */
6767
line-height: 1.5; /* 2 */
6868
}
6969

70+
71+
/**
72+
* Inherit font-family and line-height from `html` so users can set them as
73+
* a class directly on the `html` element.
74+
*/
75+
76+
body {
77+
font-family: inherit;
78+
line-height: inherit;
79+
}
80+
7081
/**
7182
* 1. Prevent padding and border from affecting element width.
7283
*

0 commit comments

Comments
 (0)