CSS Lengths

A length in CSS is defined by concatenating the number of units and the unit identifier together. For example, 5cm means 5 cm (centimeters). 20pt means 20 pt (points).

CSS defines two kinds of length unit:

        <style type="text/css"> 
        p { 
            background: grey; 
            width: 5cm; 
            font-size: 20pt; 
        <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> 
Click to view the demo
  HTML CSS Book 

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