CSS Font

Font Family In CSS :

The font group of a text is placed with the font-family property.
The font-family house should hold many font names as a “fallback” system. If the browser doesn’t help the first font, it tries another font.
Focus on the font you would like, and end with a simple household, to let the browser select a similar font in the general household, if number other fonts are available.

Example :

p{font-family:”Times New Roman”, Times, serif;}

Font Style In CSS :

The font-style property is certainly caused by applied to establish italic text.
This property has three prices:

  • standard – The text is revealed normally
  • italic – The text is revealed in italics
  • oblique – The text is “leaning

Example :

p.normal {font-style:normal;}
p.italic {font-style:italic;}
p.oblique {font-style:oblique;}

Font Size In CSS :

The font-size price is definitely  relative size.
Absolute size:

  • Units the writing to a specified size
  • Does not allow a person to improve the writing size in most browsers.
  • Absolute size is useful once the bodily size of the result is known

General size:

  • Units the size in accordance with surrounding things
  • Enables a person to improve the writing size in browsers

Use a Combination of Percent and Em :

Example :

body {font-size:100%;}
h1 {font-size:2.5em;}
h2 {font-size:1.875em;}
p {font-size:0.875em;}

Our code now works great! It shows the same text size in all browsers, and allows all browsers to zoom or resize the text.

Set Font Size With Em :

The size can be calculated from pixels to em applying this system: pixels/16=em.

Example :

h1 {font-size:2.5em;} /* 40px/16=2.5em */
h2 {font-size:1.875em;} /* 30px/16=1.875em */
p {font-size:0.875em;} /* 14px/16=0.875em */

In the example over, the writing size in them is exactly like the last example in pixels. However, with the them size, it’s possible to adjust the writing size in every browsers.

Set Font Size With Pixels :

Setting the text size with pixels gives you full control over the text size:

Example :

h1 {font-size:40px;}
h2 {font-size:30px;}
p {font-size:14px;}

The example above allows Internet Explorer 9, Firefox, Chrome, Opera, and Safari to resize the text.
Posted in CSS

Leave a Reply

Your email address will not be published. Required fields are marked *