CSS font-size property
CSS allows you to change the font size, sure thing. However, avoid the temptation to adjust the paragraph's font size and make it look like a heading, and vice versa, make headings look like paragraphs. Use proper HTML tags for headings (<h1>
...<h6>
) and paragraphs (<p>
) and specify their values according to their priority on a page. It's crucial for visual hierarchy and general scannability.
There are two ways to define the font-size
property — using either absolute or relative size values. The first one doesn't allow users to change the text size in all browsers, which is horrible from the accessibility viewpoint. On the flip side, it works perfectly for designs with predefined physical measurements when text needs to match other elements.
Conversely, the relative size allows you to change the font size in browsers. It's the best choice for large body text pieces, so users can change it to fit their needs. Developers usually use pixels to specify the absolute font-size
value and em
for relative font sizes.