Tuesday, May 31, 2011

Font type with HTML?

How do I use HTML to change the font? Not the size or color, I mean the style. As in, verdana, times new roman. And are there any more interestings ones I can use, other than arial and courier new, etc.Font type with HTML?
Whenever building a website, you must keep in mind that it will be visited by people with different systems, browsers and missing fonts. Thus your webpage will not look the same everywhere.



In the old days, fonts were displayed using the %26lt;font%26gt; tag as follows:

%26lt;font face=';arial'; color=';red';%26gt;This is some text!%26lt;/font%26gt;

http://www.w3schools.com/tags/tag_font.a



Today, the %26lt;font%26gt; tag is considered obsolete and instead, the ';style'; element has been widely accepted.



If you want your favourite font on the entire webpage, then add to the %26lt;body%26gt; tag as follows:

%26lt;body style=';font:verdana';%26gt;



If you want to change the look of a particular paragraph, then modify the %26lt;p%26gt; tag:

%26lt;p style=';font:verdana';%26gt;



If you want to change the look of only a few words in a paragraph, use the %26lt;span%26gt; tag as follows:

%26lt;span style=';font:verdana';%26gt;This is some text%26lt;/span%26gt;



You can embed your favourite fonts into a webpage but its not widely supported. Have a look at: http://www.netmechanic.com/news/vol3/css



As web-pages get bigger and more complicated, it can get tedious to manage those tags.

I'd recommend that you learn how to implement cascading style sheets (CSS) and have complete control on how your website looks and performs.



Happy Coding !Font type with HTML?
You can use any that are out there. Just might not show up on everyones computer viewing your page. You need to embed them in your page like you would a video. If you have microsoft word you can view samples of fonts there.
It would have to be %26lt;font face=';verdana';%26gt;

but you should use popular fonts, because if someone viewing your site doesnt have the font you indicate installed on their computer, then it will just show up as the default ugly font.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.