the murmurous sea

CSS: em vs. rem 본문

#dev/개념정리

CSS: em vs. rem

lunacer 2020. 4. 6. 15:13

1. both

Font size units.

Flexible, scalable units which are translated by the browser into pixel values,

Both rem and em are relative units, px is not.

 

2. em

   : em inherits and scales relative to the font size of the element on which they are used.

   : Assumes the parent is 1em(100%). Children inherit size by scaling in relation to the parent size.
   : The name em was originally a reference to the width of the capital M in the typeface and size being used, which was often the same as the point size.

 

3. rem

   : rem is only relative to the root(HTML). Root em

 

'#dev > 개념정리' 카테고리의 다른 글

Poptrox  (0) 2020.04.13
@-ms-viewport {width: device-width;}  (0) 2020.04.13
CSS: flexbox  (0) 2020.04.07
CSS: alignment  (0) 2020.04.04
CSS: inline-block  (0) 2020.04.04
Comments