Should I be setting a base font size?
Hello, I am developing my first responise website and been trying to learn as much as I can (really enjoying the videos on YT). One thing I can't really find the answer to is if I should be setting a base font-size on the html element for rem to go off of. I know the default is generally 16px so in theory I should be fine not setting a base side right? Or is it good practice to set a base size? Thanks
9 Replies
I think to go with default font size.
whatever you do, never set the base font size in pixels. It's an accessibility nightmare
you're basically saying to anyone with a visual impairment that they can fuck off and not use your site
it's best to just leave it at the default and not mess with it on html of body. If you really do have to mess with the body font size, set it in
rem
, but never, ever px
I was thinking more like setting a base font at like font-size: 16px at the HTML element but looks like I should not do that so I will skip it. Thanks for the feedback
you can set it to something in rem, but never ever in px
What about the 62% ppl do? How does that help ?
That is also not recommended:
https://fedmentor.dev/posts/rem-html-font-size-hack/#benefits-pros
FED Mentor
Should I change the default HTML font-size to 62.5%? - FED Mentor
The pros and cons of a very common frontend hack to manage rem unit sizing
It makes 1 rem equal 10px for easy math, but yeah, what Islandstone said
Thanks for that link. Its a good read and helpful to know what i was getting in for
A better question: do you have a good reason to change the default font size?
Most of the time devs change the default to make it easier for them and screw the end user. That’s a bad reason. Don’t do that (that’s where the 62.5% came from).
Instead, look at your site from a user’s perspective. If the font face a bit too small for the current size? The bump up the font size on
body
to like 1.125rem
. Does that look better? If not, change it again until it looks good.
But always have a valid reason for any change —especially something so important like font size!