Typography & Color
Prev: Positioning & Stacking | Up: properties | Next: Custom Properties & Animation
Rel: Color & Value Functions, Responsive Design & Theming
Ref: MDN Web Docs — CSS Fonts
Tags: #public #web #css #properties #typography #color
Contents
Readable Type Defaults
- Use unitless
line-height(e.g.,1.5) so child elements inherit the multiplier rather than a fixed computed pixel height. - Use
text-wrap: balanceon headings andtext-wrap: prettyon body paragraphs to prevent awkward single-word orphans.
body {
font-family: system-ui, -apple-system, sans-serif;
line-height: 1.55;
text-wrap: pretty;
}
h1, h2 {
line-height: 1.2;
text-wrap: balance;
}
Color Scheme & System Accents
color-scheme: light dark: Opts scrollbars, form controls, and default canvas colors into light/dark OS themes.accent-color: Tints native checkboxes, radio buttons, and range sliders in one line.
:root {
color-scheme: light dark;
accent-color: oklch(58% 0.18 250);
}
Linked from
- tuts/css/at_rules/keyframes_and_fonts
- tuts/css/functions/color_and_value_functions
- tuts/css/properties
- tuts/css/properties/custom_properties_and_animation
- tuts/css/properties/positioning_and_stacking
- tuts/css/properties/typography
- tuts/css/properties/typography/accent-color
- tuts/css/properties/typography/color
- tuts/css/properties/typography/color-scheme
- tuts/css/properties/typography/font-family
- tuts/css/properties/typography/font-size
- tuts/css/properties/typography/line-height
- tuts/css/properties/typography/text-wrap
- tuts/css/properties/typography_and_color
- tuts/html/elements/text_and_lists
Related notes
- tuts/css/functions/color_and_value_functions Linked here; links to this page; shared tags: #color, #css, #web
- tuts/css/properties Linked here; links to this page; shared tags: #css, #properties, #web
- tuts/css/properties/custom_properties_and_animation Linked here; links to this page; shared tags: #css, #properties, #web
- tuts/css/properties/positioning_and_stacking Linked here; links to this page; shared tags: #css, #properties, #web
- tuts/css/properties/typography links to this page; shared tags: #css, #properties, #typography, #web
- tuts/css/properties/typography/accent-color links to this page; shared tags: #css, #properties, #typography, #web
- tuts/css/properties/typography/color links to this page; shared tags: #css, #properties, #typography, #web
- tuts/css/properties/typography/color-scheme links to this page; shared tags: #css, #properties, #typography, #web
- tuts/css/properties/typography/font-family links to this page; shared tags: #css, #properties, #typography, #web
- tuts/css/properties/typography/font-size links to this page; shared tags: #css, #properties, #typography, #web