Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


Search
The Business Internet


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us
Laptops
Condos For Sale
Laptop Batteries
Rackmount LCD Monitor
Corporate Gifts
Prepaid Phone Card
Server Racks
Computer Hardware
Shop
Build a Server Rack
Memory Upgrades
Imprinted Gifts
Corporate Awards
Data Center Solutions

Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

July 26, 1998

Putting Style Sheets in Perspective

font-family

Initial Value:
depends on user agent
Allowed Values:
family-name
generic-family
Applies to:
all elements
Inherited?:
yes

Your old favorite, <FONT = ""> to specify a font type has been deprecated. That's not nearly as bad as it sounds since you may now specify a font type with Style Sheets. Not only may you specify the font, but you can now specify alternate fonts in case your favorite font is not available on your visitor's system! Font types are specified not by font-style as you might suppose, but by font-family.

There are two values that can be applied to font-family, the family-name and a generic-name. The family-name is the Proper name of the font, such as Arial, or Times Roman. and more than one family-name may be used in the same declaration. Family-names should be separated by a comma.

P {	font-family: Arial, "Times New Roman" ;	}

Arial

Times Roman

When specifying multiple font-family values the user-agent would first look for the Arial font to display the text. If Arial was not available it would then attempt to display the text in Times New Roman. It's a good idea to design around standard fonts as not all visitors to your site will have your favorite font on their system.

Notice the quotes around "Times New Roman". When a family-name contains spaces, it is necessary to place the name within quotes to prevent the browser from getting confused. This is also necessary if the family-name contains symbols.

The W3C specifies that

"Font names containing whitespace should be quoted: "

and

"If quoting is omitted, any whitespace characters before and after the font name are ignored and any sequence of whitespace characters inside the font name is converted to a single space."

To me, these two statements together seem almost like a contradiction and yet, from experience I've found that enclosing the font-family in quotes in the Style Element is acceptable, to do so within the Style Attribute is not valid HTML.

A generic-name may be used along with a family-name in a declaration to ensure that the user-agent displays the page as you intended for it to be seen even when the font-family is not available. This is not the perfect solution to un-available fonts, but is far better than allowing the user-agent to default to it's own font. It is suggested that the generic font family be placed as the last alternative in the font-family declaration.

Do not put quotes around the generic-family; if you do so, the browser will look for a family-name!

BODY 	{font-family:	"MS Serif", "Times New Roman", serif	;}

The above example demonstrates how to specify alternate fonts within the Style Element. The example below demonstrates how those fonts would display in a browser.

< style="font-family: MS Serif, Times New Roman">
MS Serif or Times

MS Serif or Times

<P style="font-family: Helvetica, Arial">
Helvetica or Arial

Helvetica or Arial

<P style="font-family: serif">
Any serif font

Any serif font

Serif - A serif font has short cross-strokes.
Sans-serif - without the cross-strokes is called sans serif. (Sans is a French word meaning "without").
Monospace - A fixed width font in which each character takes up exactly the same amount of space.
Cursive - Cursive fonts resemble hand-writing.
Fantasy - Fantasy fonts can be very fancy, carry strange decorations or odd shapes. They are used mainly for display purposes and not for large bodies of text.

Additional Resources:

Putting Style Sheets in Perspective: Index
Putting Style Sheets in Perspective: Table of Contents
Putting Style Sheets in Perspective:font-style


Up to => Home / Authoring / Style / Sheets / Fonts




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers