CSS Fonts
As we saw the text property in the smilar manner we can define the proerty of the font as well.Type of font family, font style & font size. There are many ways in which we can define all the above property of the font.
Font Family:
There are two type of font family which is extensively used in web. there are Serif and Sans-serif.Code to define the is mentioend below:
h1{font-family:font-family:{“Times New Roman”, Times, serif;}
In font please try to use the web safe font only this will have to reduces the size of the page and also good for SEO.
Font style:
We can change the style of the text using the this property.We can change them to bold italic etc. to change the style of the font the code is mentioned below.
p.normal {font-style:normal}
p.italic {font-style:italic}
p.oblique {font-style:oblique}
Font size:
We can define the custom size for each element in HTML. Size of the font can be define in pixels i.e px and other we can define the size in em. Let see how we can define th size in pixel
h1 {font-size:40px;}
h2 {font-size:30px;}
p {font-size:14px;}
We can also define the size of the font in EM to calculate EM is very simple we have to just divide the point of the font by 16 to get the exact EM for e.g. 40px = 2.5em (40/16)
h1 {font-size:2.5em;}
h2 {font-size:1.8em;}
p {font-size:0.8em;}
We can also define the font size in % if needed.This is generally used create the all resolution compatible layout.
body {font-size:100%}
Using this css tag w can control all the property of the font and get the desired output.