Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 28th, 2005, 11:13 AM   #1
blueandconfused
Newbie
 
Join Date: Apr 2005
Posts: 16
Rep Power: 0 blueandconfused is on a distinguished road
changing font style

how do you change the font style in an html document?
blueandconfused is offline   Reply With Quote
Old Apr 28th, 2005, 12:27 PM   #2
kirkl_uk
Programmer
 
kirkl_uk's Avatar
 
Join Date: Apr 2005
Location: England
Posts: 86
Rep Power: 4 kirkl_uk is on a distinguished road
Send a message via MSN to kirkl_uk
I think the most common way nowadays is to use the style attribute. Example:

<p style="font-family: Verdana; font-size: 10pt; color: #0000FF">
Your text goes here.
</p>

http://www.w3schools.com has some very good information on HTML. The method I have used is CSS (Cascading Style Sheets), so look it up if you need more information. There are other ways, but I feel this is most common.

kirkl_uk
kirkl_uk is offline   Reply With Quote
Old Apr 28th, 2005, 12:54 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
If you're changing all the font settings, it's quicker to do:
style="font: Verdana 10pt #0000FF"
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 2nd, 2005, 11:30 AM   #4
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
The old-school method (probably officially deprecated now) is with the FONT tag:

<FONT face="Helvetica,Arial">
 <H2>Old School Font Switch</H2>
</FONT>

Just for an alternative view. It's worth bearing in mind that you should list more than one font family, separated with commas; not all systems have all fonts and if you specify a font that the user's browser doesn't have, it'll just use the default. If you have provided a list, the browser will use the first font in the list that it has available. So for a Sans Serif font, you could do:

<P style="font-family: Sans, Helvetica, Arial">foo</P>

Sans takes care of a lot of systems. It's a rare Mac that doesn't have Helvetica, and Windows machines will manage with Arial if they don't have the other two.
mackenga is offline   Reply With Quote
Old May 2nd, 2005, 3:46 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
To be pedantic, "sans" should be in lowercase. :p
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:12 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC