Sunday, February 2, 2014

CSS: Units!

Many values in styles sheets specify a size, length, width, etc. There are different units to spcify that:

Absolute units

You use these units if you mean something to be printed, because otherwise it doesn't really mean anything on a computer screen:
mm
millimeter
cm
centimeter
in
inch
pt
1/72 of an inch
pc
12 points

Relative units


I think these you should use more often to choose your font-size, etc:

em
unit relative to the current font size
ex
the height of a lowercase "x" in the font
px
a pixel, which is relative to the display resolution of the screen
%
percentage

No comments:

Post a Comment