Skip to content

Instantly share code, notes, and snippets.

@Samjin
Created July 31, 2016 01:11
Show Gist options
  • Save Samjin/f065fcab3c4032bfb2405831fc549d05 to your computer and use it in GitHub Desktop.
Save Samjin/f065fcab3c4032bfb2405831fc549d05 to your computer and use it in GitHub Desktop.
Rem vs Em
http://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984
rem and em units are computed into pixel values by the browser, based on font sizes in your design.
em units are based on the font size of the element they’re used on.
rem units are based on the font size of the html element.
em units can be influenced by font size inheritance from any parent element
rem units can be influenced by font size inheritance from browser font settings.
Use em units for sizing that should scale depending on the font size of an element other than the root.
Use rem units for sizing that doesn’t need em units, and that should scale depending on browser font size settings.
Use rem units unless you’re sure you need em units, including on font sizes.
Use rem units on media queries
Don’t use em or rem in multi column layout widths - use % instead.
Don’t use em or rem if scaling would unavoidably cause a layout element to break.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment