css define font code example

Example 1: css font

@font-face {
  font-family: "Name of the font"; /*eg Ubuntu*/
  src: url("your/path/to/the.font");
}

p{
  font-family: "Ubuntu";
}

Example 2: css font

p {
  font: italic small-caps bold 12px/30px Georgia, serif;
}

/*
The font property is a shorthand property for:
font-style
font-variant
font-weight
font-size/line-height
font-family
*/

Example 3: font face html

@font-face { font-family: 'meine-schrift';
             src: url('pfad/zu/meinerschrift.ttf') format('truetype'); }

Example 4: define font css

body {
  font: normal small-caps normal 16px/1.4 Georgia;
}

/* is the same as:

body {
  font-family: Georgia;
  line-height: 1.4;
  font-weight: normal;
  font-stretch: normal;
  font-variant: small-caps;
  font-size: 16px;
}
 */

Tags:

Css Example