Units of measurement in CSS3

As many CSS properties already discussed in previous chapters like padding, margin, height and width. Theses properties has the values which used by the units.In CSS3 there are many units for measurement.These units divided into two categories
1) Absolute
2) Relative
Both of the categories are explained below with different units.

Relative units

As the word show relative unites are used for length relative to other's length. There are following length units are given below.


Unit Description
px This unit is used to specify length in pixels.
em This unit is used to specify length according to current font-size.
ex This unit is used for x-height, approximately the height of a lowercase “x” in the font
rem This unit is used as the equal size of the root element like html.
vw This unit is used for specify width according to the current view-port width.
vh This unit is used to specify height according to the current view-port height.
vm This unit used to specify length with respect to both height and width.
% This unit is used according the percentage of it's parents size.


Absolute units

As the word show relative unites are used for predefined meanings or real-world equivalents. There are following length units are given below.


Unit Description
px This unit is used to specify absolute measurement in pixels.
pt This unit is used to specify length in points.
pc This unit is used to specify length in picas.
mm This unit is used to specify length in millimetres.
cm This unit is used to specify length in centimetres.
in This unit is used to specify length in inches.








The Best

Comment here

If you have any query, if you want to know something about any of technical course related to computer science field, if you have any suggestion about relevant to uploaded content or if you anything wrong here (any mistake in content) than please contact us. Keep in mind, comment should be according to community guidelines.