Saturday, July 25, 2015

21. HTML Fonts

 HTML Tutorial

Fonts play very important role in making a website more user friendly and increasing content readability. Font face and color depends entirely on the computer and browser that is being used to view your page but you can use HTML tag to add style, size, and color to the text on your website. You can use a tag to set all of your text to the same size, face, and color.
The font tag is having three attributes called size, color, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the tag. The text that follows will remain changed until you close with the tag. You can change one or all of the font attributes within one tag.
Note: The font and basefont tags are deprecated and it is supposed to be removed in a future version of HTML. So they should not be used rather, it's suggested to use CSS styles to manipulate your fonts. But still for learning purpose, this chapter will explain font and basefont tags in detail.

Set Font Size

You can set content font size using size attribute. The range of accepted values is from 1(smallest) to 7(largest). The default size of a font is 3.

Example




</span><span class="pln">Setting Font Size</span><span class="tag">
size="1">Font size="1"
/> size="2">Font size="2"
/> size="3">Font size="3"
/> size="4">Font size="4"
/> size="5">Font size="5"
/> size="6">Font size="6"
/> size="7">Font size="7"
This will produce following result:
Font size="1"
Font size="2"
Font size="3"
Font size="4"
Font size="5"
Font size="6"
Font size="7"

Relative Font Size

You can specify how many sizes larger or how many sizes smaller than the preset font size should be. You can specify it like or

Example




</span><span class="pln">Relative Font Size</span><span class="tag">
size="-1">Font size="-1"
/> size="+1">Font size="+1"
/> size="+2">Font size="+2"
/> size="+3">Font size="+3"
/> size="+4">Font size="+4"
This will produce following result:
Font size="-1"
Font size="+1"
Font size="+2"
Font size="+3"
Font size="+4"

Setting Font Face

You can set font face using face attribute but be aware that if the user viewing the page doesn't have the font installed, they will not be able to see it. Instead user will see the default font face applicable to the user's computer.

Example




</span><span class="pln">Font Face</span><span class="tag">
face="Times New Roman" size="5">Times New Roman
/> face="Verdana" size="5">Verdana
/> face="Comic sans MS" size="5">Comic Sans MS
/> face="WildWest" size="5">WildWest
/> face="Bedrock" size="5">Bedrock
/>
This will produce following result:
Times New Roman
Verdana
Comic Sans MS
WildWest
Bedrock

Specify alternate font faces

A visitor will only be able to see your font if they have that font installed on their computer. So, it is possible to specify two or more font face alternatives by listing the font face names, separated by a comma.
 face="arial,helvetica">
 face="Lucida Calligraphy,Comic Sans MS,Lucida Console">
When your page is loaded, their browser will display the first font face available. If none of the given fonts are installed, then it will display the default font face Times New Roman.
Note: Check a complete list of HTML Standard Fonts.

Setting Font Color

You can set any font color you like using color attribute. You can specify the color that you want by either the color name or hexadecimal code for that color.
Note: You can check a complete list of HTML Color Name with Codes.

Example




</span><span class="pln">Setting Font Color</span><span class="tag">
color="#FF00FF">This text is in pink
/> color="red">This text is red
This will produce following result:
This text is in pink
This text is red

The Element:

The element is supposed to set a default font size, color, and typeface for any parts of the document that are not otherwise contained within a tag. You can use the elements to override the settings.
The tag also takes color, size and face attributes and it will support relative font setting by giving size a value of +1 for a size larger or -2 for two sizes smaller.

Example




</span><span class="pln">Setting Basefont Color</span><span class="tag">
face="arial, verdana, sans-serif" size="2" color="#ff0000"> This is the page's default font.

Example of the <basefont> Element size="+2" color="darkgray"> This is darkgray text with two sizes larger face="courier" size="-1" color="#000000"> It is a courier font, a size smaller and black in color. This will produce following result:
This is the page's default font.

Example of the Element

This is darkgray text with two sizes larger
It is a courier font, a size smaller and black in color.

0 comments:

Post a Comment

 
Designed by Kakada Akkarak Surakkiat
Technology: របៀប​ដំឡើង Windows 10 នៅ​លើ​កុំព្យូទ័រ!: អ្នកត្រូវដឹងឲ្យ ច្បាស់ពី Windows ដែលអ្នកយក ទៅដំឡើង ដោយសារមាន Windows ខ្លះមានការ crack រួច ឬខ្លះត្រូវការ Product key ភ្លាម និងខ្លះទៀត អាចត្រូវ skip កន្លែងវាយលេខ Product key បាន តែត្រូវ Activate តាមក្រោយ ទើបប្រើប្រាស់បាន។ Technology: ដំណោះ​ស្រាយ Error 80240020 នៅ​ពេល​តម្លើង Windows 10 Free តាម​រយៈ​ការ Upgrade : មាន បញ្ហាមួយចំនួន ទាក់ទងនឹង ការតម្លើង Windows 10 នេះផងដែរ ប៉ុន្តែបញ្ហានោះ កើតឡើង ទៅលើតែកុំព្យូទ័រ មួយចំនួនប៉ុណ្ណោះ គឺខណៈពេល ដែលអ្នក ប្រើប្រាស់ បានទាញយក Windows 10 ចប់ហើយ វាបាន បង្ហាញនូវ ផ្ទាំង error មួយ ដែលមានលេខ សំគាល់ error នោះគឺ 80240020។ ដូចនេះដើម្បី ដោះស្រាយ នូវបញ្ហា មួយនេះ សូមលោកអ្នក តាមដានអាន ជាមួយយើងខ្ញុំ ទាំងអស់គ្នា !!