I am trying to make a theme for Hugo for a simple blog. But I don’t know what the standard practices for setting font size for the main text are. Right now I have left them untouched so they default to whatever you have set on your browser. But this doesn’t seem good because browser font size is usually set to something smaller than legible.

Is it desirable to set font size by the way of absolute numbers (like 22px)? I don’t know how this would translate over different screens with different resolutions. I also know how to make responsive changes in CSS but I don’t know what are good numbers to set font sizes to.

Vague question but any help is appreciated.


edit: I would much prefer to be able to use the set browser size for reference at least because I don’t wanna push my taste on other people. Same with font-families.

  • anon8008
    link
    fedilink
    arrow-up
    2
    ·
    4 years ago

    Common practise is to use the browser’s default font-size and scale the website using em and rem units (among others).

    E.g. Chrome and Firefox have a default font-size of 16px. This is a good start. If you would like to increase that font size on bigger screens (non-mobile) you can use a media query and scale it up based on screen size.

    When prototyping I often start off with a small screen (portrait phone) as default with a font-size of 1rem and increase it using breakpoints such as these: https://getbootstrap.com/docs/4.5/layout/overview/#responsive-breakpoints

    Example: Serif fonts have extra details which are easier to distinguish at a slightly higher font size. I set the base font-size at 1rem (16px), on tablets and up a font-size of 1.125rem (18px), on desktops we scale it up even further to 1.25rem (20px), etc. I would recommend not to set the body font-size too large, as some people with bad sight or sitting further from their monitor may have their browser set to zoom. Unless I use special typefaces I tend to stick with 16-24px for body font-size. Everything else on the design scales based on that.

    Optionally you can set the body font smaller (e.g. 12px) in your print stylesheet if printing is desired.