gevans Posted August 19, 2009 Share Posted August 19, 2009 Hey guys, Just a bit of curiosity over here. When I first started making websites i set the font size of the body in pixels; body {font-size: 15px;} Then I got annoyed of having the header elements at their default size so started using the asterix to set all fonts; * {font-size: 15px;} Recently I've started setting my default font in em; * {font-size: 1.0em;} Then all other font size changes are made in percentages; span.this-style {font-size: 88%;} I've been doing this for accessibility, and ease of changing specific font sizes within a page. What are other people doing, what works for you? Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/ Share on other sites More sharing options...
Daniel0 Posted August 19, 2009 Share Posted August 19, 2009 I usually use a reset stylesheet and then use em for font sizes. Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/#findComment-901749 Share on other sites More sharing options...
KevinM1 Posted August 19, 2009 Share Posted August 19, 2009 I read in an article that a good way to do it is to set the base size in pixels, then everything else in ems. I haven't tried it myself yet, but it sounds intriguing. Link to article: http://net.tutsplus.com/tutorials/html-css-techniques/six-ways-to-improve-your-web-typography/ Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/#findComment-901762 Share on other sites More sharing options...
corbin Posted August 19, 2009 Share Posted August 19, 2009 Ooo, interesting article. I was going to say (and although it doesn't say this, this is probably the reason they do it offset from a base in pixels) that em is the size of M (or maybe m... don't remember), so it depends on the current font/size, so doing everything in em doesn't make sense. Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/#findComment-901764 Share on other sites More sharing options...
gevans Posted August 19, 2009 Author Share Posted August 19, 2009 I'm going to have a read of that article, looks good. I often use javascript to incresse/decerease font size, but have had issues with that when setting the font size using pixels. It's far more reliable doing it with em or % (or combo). Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/#findComment-901773 Share on other sites More sharing options...
nrg_alpha Posted August 19, 2009 Share Posted August 19, 2009 For my web projects, I use the following CSS rule: body { font-size:xx-small; voice-family:"\"}\""; voice-family:inherit; font-size:x-small } That is based off of sample code from the book 'Bulletproof Web Design', which dedicates the entire first chapter to font flexibility. This in a nutshell simply sets up a uniform yet flexible base across browsers (including most older ones) and works quite well. For actual font size declarations, I use percentages. Quote Link to comment https://forums.phpfreaks.com/topic/170970-font-sizes/#findComment-901864 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.