Jump to content

font sizes


gevans

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.