The <font> tag is deprecated, so instead we must use the font and text properties. They are as follows:
font-family:Arial, Helvetica, sans-serif;
color:#6699CC;
font-weight:75%;
The W3C recommend that you stay away from absolute length units when it comes to fonts - such as px and pt - as they render inconsistently across browsers and do not resize. Instead, it is recommended that you use em or percentage values. Also, for accessibility purposes, fonts that are too small should be avoided.
Setting your base font (body font) to 1em or 100% is equivalent to setting the font to the user's preference. Medium is the default font size for browsers, which is equivalent to 16px (just so you can get an idea of what size thsi is). You might find that 100% is too big for you. If this is the case, why not try 68.75% or 75% (1.1em or 1.2em). These are generally considered happy mediums.
Percentage or em's are normally the best choice. I, personally, prefer percentages, as em units can sometimes present you with inconsistent results per browser. If that doesn't bother you, then go ahead and use them, or if you think working with percentages might be easier, use those. Whatever makes you feel comfortable!
Use font to write shorthand styles. The advantages of CSS shorthand are that it cuts your filesize down and is quicker to write.
font: [ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family>;
Here's an example taken from my site:
font:bold 120% Verdana, Arial, Helvetica, sans-serif
This example specifies a font of 120%, bold and belonging to the Verdana family.
Here, I'll show you how to use the span tag to apply formatting to text. This is useful when you want to make certain parts of your text stand out.
The way to do this is to create some ultra-funky classes that will emphasise your text.
.emphasis {
font:bold 140% Times;
color:orange;
}
The class emphasis has a bold, orange font, of size 140% and uses the Times type-face.
Note, try to give your classes names that pertain to the element(s) they are going to be applied to. Not what they do.
<p>Homer Simpson:I am so smart! I am so smart! S-M-R-T! I mean <span class="emphasis">S-M-A-R-T!</span></p>
As you can see, the text surrounded with a span tag, on which we have applied our emphasis class, is now much more noticable.
Got any questions or comments? Feel free to mail me @ helen@alternategateways.com.
Back to resources.