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 IdentifierDescription
inInches
cmCentimeters
mmMillimeters
ptPoints (1 point is 1/72 of an inch)
pcPicas (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>
  
Click to view the demo
Home 
  HTML CSS Book 
    CSS  

CSS Value:
  1. CSS Colors
  2. CSS Lengths
  3. Absolute units of measurement
  4. Relative units of measurement
  5. Working with Pixels
  6. Working with Percentages
  7. CSS Unit Calculations
  8. Using CSS Angles
  9. Using CSS Times
Related: