Working with Percentages
You can express a unit of measurement as a percentage of another property value. You do this using the % (percent) unit.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
p {
background: grey;
color:white;
font-size: 200%;
width: 50%;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the website</a>
<p>I like <span>HTML</span> and CSS.</p>
</body>
</html>
Home
HTML CSS Book
CSS
HTML CSS Book
CSS
CSS Value:
- CSS Colors
- CSS Lengths
- Absolute units of measurement
- Relative units of measurement
- Working with Pixels
- Working with Percentages
- CSS Unit Calculations
- Using CSS Angles
- Using CSS Times
Related: