Relative to Font Size

Description

The following code uses a Relative Unit.

Example


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
p  {<!--from  w ww .jav  a  2 s  . c  o  m-->
    background: grey;
    color:white;
    font-size:  15pt;
    height: 2em;
}
</style>
</head>
<body>
    <p>This is a test.</p>
    <p style="font-size:12pt">This is another test.</p>
</body>
</html>

Click to view the demo

The code above sets the height property to 2em, which means that the height of p elements is twice the font size.

A font-size is 15pt for the first p element. The font-size is 12pt on the second p element.





















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