CSS LENGTH UNITS
Do you like this story?
Length units in CSS fall under two categories: relative units and absolute units.
Relative units include:
Below are examples for each unit type:
CSS Declaration | Output |
p {font-size:9px;} | Font Size 9px. |
p {font-size:3em;} | Font Size 3em. |
p {font-size:3ex;} | Font Size 3ex. |
p {font-size:0.2in;} | Font Size 0.2 inch. |
p {font-size:0.5cm;} | Font Size 0.5 cm. |
p {font-size:12mm;} | Font Size 12 mm. |
p {font-size:24pt;} | Font Size 24 pt. |
p {font-size:2pc;} | Font Size 2 pc. |
The general recommendation is to use relative length units. This way, you allow the users to increase or decrease the font size as they please. Using absolute length units takes away this option.
This post was written by: Rajendra Prasad
Rajendra Prasad is a professional blogger, web designer and front end web developer. Follow him on Facebook