Go Back   DevHunters.com l Webmaster Forum - Web Advertising - Web Design - SEO Forums > Webmaster / Coding / Web Design Discussion > HTML / XHTML / CSS

HTML / XHTML / CSS Discuss HTML, XHTML and CSS coding in this forum.

Have A Look At Some Of Our Webmaster Related Sponsors!


Script Directory


Advertise Here


Market Leverage


Free Templates

3D Guide-Characters
3D Guide-characters


Advertise Here

Reply
 
LinkBack Thread Tools Display Modes
Old 04-16-2008, 12:09 AM   #1 (permalink)
New Hunter
 
Visualrise's Avatar
 

Join Date: Apr 2008
Posts: 3
iTrader: 0 / 0%
Hunter Bux: 0
Visualrise is on a distinguished road
Post CSS Font Size Tutorial

Believe it or not, how you describe your CSS font size handling to the browser has a large effect on the end user. Today the most popular way of sizing fonts in CSS is through pixels, this is because designers have pixel perfect control over the look and feel of their content.

Sound the alarms! This is not a very effective technique! In the worlds most popular browser, users cannot resize the text! (This is fixed in IE7 by their "zoom") Still, we want to make the web usable right? So here is an approach thats effective.We are going to use two techniques, keywords and relative length units.

Keyword: larger smaller smallest
Relative units: em %(percentage)

Let's implement! The first bit of code you're going to want to add to your CSS is the following. I will explain with inline comments:

Code:
body {
   font-size: x-small; /* This is for IE5/Win */
   voice-family: ""}""; /* Only IE5 recognizes this and thinks the CSS ends */
   voice-family: inherit;
   font-size: small; /* For compliant browsers */
}

html>body {
   font-size: small; /* For Opera */
}
So now in your CSS when you want to describe how large or small a font should be you use a percentage for example:

Code:
h1 {
   font-size: 170%;
}

p .smalltext {
   font-size: 65%;
}
Note: 100% is the default "small" size.

Now we have improved the usability of our website greatly, the fonts can all be resized perfectly across all browsers.

Credit goes to the book "Bullet Proof Web Design" which taught me this.
__________________
Waterloo based web development: http://www.visualrise.com
(Sybase, Google, Oracle, Adobe, McAfee, all have offices in Waterloo!)
Visualrise is offline   Reply With Quote
Old 04-16-2008, 03:36 AM   #2 (permalink)
Field Master
 
webeweb's Avatar
 
Join Date: Mar 2007
Location: USA
Posts: 241
iTrader: 2 / 100%
Hunter Bux: 433.00
webeweb will become famous soon enough
Default

That is a cool tutorial. Thanks for sharing!
__________________
Social Bookmark Advertising
webeweb is offline   Reply With Quote
Old 04-16-2008, 06:12 AM   #3 (permalink)
Senior Moderator
 
SpOrTsDuDe.Reese's Avatar
Default

I recently have always used px, but since about 3 months ago I switched, I have gotten emails saying how much readable my site is now. Very nice tutorial!
__________________
+-(X)HTML, CSS, JavaScript, SEO, PHP, Flash-+
Code:
<style type="text/css"> u { text-decoration: none; } </style>
GameYin. Redesigning for DevPlooth.
SpOrTsDuDe.Reese is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 10:34 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios