Absolute units of measurement
The cm and pt units are examples of absolute units. These units are real-world measurements. CSS supports five types of absolute units
Unit Identifier | Description |
---|---|
in | Inches |
cm | Centimeters |
mm | Millimeters |
pt | Points (1 point is 1/72 of an inch) |
pc | Picas (1 pica is 12 points) |
You can mix and match units and mix absolute and relative units.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
p {
background: grey;
color:white;
width: 5cm;
font-size: 20pt;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the website</a>
<p>I like <span>HTML</span> and CSS.</p>
<a class="myclass1 myclass2" href="http://java2s.com">Visit the website</a>
</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: