Font Properties

Description

font is the Shorthand property to set fonts in a single declaration

The format for the font property value is as follows:


font:  <font-style>  <font-variant> <font-weight> <font-size> <font-family>

Example


<!DOCTYPE html>
<html>
<head>
<style>
p.ex1{<!-- www. j a v a  2  s.  c  o  m-->
   font:15px arial,sans-serif;
}

p.ex2{
   font:italic bold 30px Georgia,serif;
}
</style>
</head>

<body>
    <p class="ex1">This is a paragraph. 
    This is a paragraph. This is a paragraph. This is a paragraph. 
    This is a paragraph. This is a paragraph. This is a paragraph. 
    This is a paragraph.</p>
    <p class="ex2">This is a paragraph. This is a paragraph. 
    This is a paragraph. This is a paragraph. This is a paragraph. 
    This is a paragraph. This is a paragraph. This is a paragraph.</p>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table