Font:-: Solution
Font:-: Solution
The browser will display text in the default font used for that browser and operating system.
Solution:-
Specify the typeface that your text will adopt using the font-family property:
p{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
}
Discussion:-
Here, weve specified that if Verdana is installed on the system, it should be used. Otherwise, the browser is
instructed to see if Geneva is installed; failing that, the computer will look for Arial, then Helvetica. If none of these
fonts are available, the browser will then use that systems default sans-serif font.
As well as specific fonts, such as Verdana or Times, CSS allows the specification of some more-generic
family names:
serif
sans-serif
monospace
cursive
fantasy
If a font-family name contains spaces, it should be enclosed in quotation marks, like so:
p{
font-family: "Courier New", "Andale Mono", monospace;
}
Fonts that you can feel fairly confident using are:
Windows:-
Arial, Lucida, Impact, Times New Roman, Courier New, Tahoma, Comic Sans, Verdana, Georgia,
Garamond
Mac:-
Helvetica, Futura, Bodoni, Times, Palatino, Courier, Gill Sans, Geneva, Baskerville, Andale Mono
Font Size:-
The font-size property can take a variety of values.
Ems
The em is a relative font measurement. If you use ems (or any other relative unit) to set your font sizes, users will be able to
resize the text in old browsers. For example, IE6 users are unable to resize text set in pixels, and have no other zoom control.
Em values can be set using decimal numbers.
For example,
To display text at a size 10% smaller than the users default (or the font size of its parent element), you could use this rule:
p{
font-size: 0.9em;
}
To display the text 10% larger than the default or inherited size, youd use this rule:
p{
font-size: 1.1em;
}
Percentages
As with ems and exes, font sizes that are set in percentages will honor users text
size settings and can be resized by users:
p{
font-size: 100%;
}
Setting the size of a p element to 100% will display your text at users default fontsize
settings (as will setting the font size to 1 em). Decreasing the percentage will
make the text smaller:
p{
font-size: 90%;
}