Percentages

Description

You can express a unit of measurement as a percentage of another property value.

You do this using the % (percent) unit.

Example

The following code expresses units as a Percentage of Another Property Value.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
p {<!--from   www. j a  va  2 s  .  co  m-->
    background: grey;
    color:white;
    font-size: 200%;
    width: 50%;
}
</style>
</head>
<body>
    <a href="http://java2s.com">website</a>
    <p>this is a test.</p>
    <a href="http://w3c.org">W3C</a>
</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