Add hanging-punctuation

This commit is contained in:
Nathan Upchurch 2024-01-02 12:38:49 -05:00
parent 0e2b0a1505
commit 9abc5719a6

View File

@ -1,46 +1,59 @@
/* // Set a baseSize to use in calculating negative indent where hanging-punctuation is not supported
1. Use a more-intuitive box-sizing model. @supports not (hanging-punctuation: first) {
*/ :root {
--baseSize: 2rem;
}
}
// Use a more-intuitive box-sizing model.
*, *::before, *::after { *, *::before, *::after {
box-sizing: border-box; box-sizing: border-box;
} }
/*
2. Remove default margin // Remove default margin
*/
* { * {
margin: 0; margin: 0;
} }
/* /*
Typographic tweaks! Typographic tweaks:
3. Add accessible line-height * Add accessible line-height
4. Improve text rendering * Improve text rendering
* Apply hanging punctuation with fallback if unsupported
*/ */
html {
text-indent: calc((var(--baseSize) / 2) * -1); // Negative indent for use where hanging-punctuation is unsupported
}
@supports (hanging-punctuation: first) {
html {
text-indent: 0;
hanging-punctuation: first last; // Although "last" isn't handled by an indentation if unsupported, we'll just try our luck here
}
}
body { body {
line-height: 1.5; line-height: 1.5;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
/*
5. Improve media defaults // Improve media defaults
*/
img, picture, video, canvas, svg { img, picture, video, canvas, svg {
display: block; display: block;
max-width: 100%; max-width: 100%;
} }
/*
6. Remove built-in form typography styles // Remove built-in form typography styles
*/
input, button, textarea, select { input, button, textarea, select {
font: inherit; font: inherit;
} }
/*
7. Avoid text overflows // Avoid text overflows
*/
p, h1, h2, h3, h4, h5, h6 { p, h1, h2, h3, h4, h5, h6 {
overflow-wrap: break-word; overflow-wrap: break-word;
} }
/*
8. Create a root stacking context // Create a root stacking context
*/
#root, #__next { #root, #__next {
isolation: isolate; isolation: isolate;
} }