Font Size and Weight
Font size determines glyph size, and font weight selects a weight supported or synthesized for the font. rem uses the root size; em in font-size uses the parent size.
Compare relative text sizing and available font weights under changed user settings.
A customer raises the default text size in their browser settings because small print is hard for them to read. On a site sized in rem, every heading and paragraph grows with that setting. On a site that fixes text in pixels, the setting is ignored. Size units are an accessibility decision, not just a matter of taste.
The rule
Size text in rem; weight it with numbers from 100 to 900.
font-size accepts several units:
px: a fixed size. Predictable, but it does not grow when the user raises the browser's default text size.rem: relative to the root (html) font size, which is 16px by default and follows the user's setting.1.5remis 24px at the default.em: relative to the parent's font size. Useful for things that should scale with their surroundings, but it compounds when nested.%: forfont-size, relative to the parent, likeem(150%=1.5em).
body { font-size: 1rem; } /* 16px by default */
h1 { font-size: 2.5rem; } /* 40px */
.dish h3 { font-size: 1.25rem; } /* 20px */
.price { font-size: 0.875rem; }/* 14px */font-weight takes numbers in steps of 100 from 100 (thin) to 900 (black). normal is 400 and bold is 700. The keywords bolder and lighter step relative to the parent.
A weight only looks right if the font has it. If you load Lora at 400 and 700 only, asking for 600 gives you the nearest available weight, and asking for bold from a font with no bold file makes the browser fake one by smearing the glyphs.