CSS Units

Name Description
px (pixels)
mm (millimeters)  3.8px
cm (centimeters) 38px
in (inches) 96px

pt (points)  4/3px
pc (picas) 16px
ex Relative to the x-height of the current font
ch Relative to width of the «0» (zero)
% 1% of parent width.

  • Any kind of margin would use % of parrent width
  • line-height would use current font line-height as 100%
  • width and height would use parent width as 100%!
  • If position:fixed then width and height would use viewport width or height as 100%
em Relative to the font-size of the element (2em means 2 times the size of the current font)
rem Relative to font-size of the root element (html)
vw Relative to 1% of the width of the viewport
vh Relative to 1% of the height of the viewport
vmin Relative to 1% of viewport’s smaller dimension

  • IE9 — vm
vmax Relative to 1% of viewport’s larger dimension
fr (fraction) Relative to 1% of viewport’s larger dimension

Support

Length Unit Chrome IE FF Safari Opera
em, ex, %, px, cm, mm, in, pt, pc 1.0

(12/11/2008)

3.0

(8/13/1996)

1.0

(10/27/2004)

1.0

(6/23/2003)

3.5

(1998)

ch 27.0

(5/21/2013)

9.0

(3/14/2011)

1.0

(10/27/2004)

7.0

(10/22/2013)

20.0

(3/4/2014)

rem 4.0

(1/25/2010)

9.0

(3/14/2011)

3.6

(8/7/2009)

4.1

(6/7/2010)

11.60

(12/6/2011)

vh, vw 20.0

(5/1/2012)

9.0

(3/14/2011)

19.0

(10/9/2012)

6.0

(7/25/2012)

20.0

(3/4/2014)

vmin 20.0

(5/1/2012)

9.0 (vm)

(3/14/2011)

19.0

(10/9/2012)

6.0

(7/25/2012)

20.0

(3/4/2014)

vmax 26.0

(3/26/2013)

Not supported 19.0

(10/9/2012)

7.0

(10/22/2013)

20.0

(3/4/2014)

version (release date)

Запись опубликована в рубрике css. Добавьте в закладки постоянную ссылку.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *