Skip to content

Instantly share code, notes, and snippets.

@mattmcgiv
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save mattmcgiv/1955e1449cc7d02224c3 to your computer and use it in GitHub Desktop.

Select an option

Save mattmcgiv/1955e1449cc7d02224c3 to your computer and use it in GitHub Desktop.
Sets root element font-size to 16px; uses rems thereafter.
html {
font-size: 16px; /*1rem=16px*/
}
h1 {
font-size: 3rem; /* 48px (16 times 3) */
}
h2 {
font-size: 2rem; /* 32px */
}
p {
font-size: 1rem; /* 16px */
}
/* Don't forget to add rem-based margins, padding, etc */
/* Then to change all font-sizes while maintaining their */
/* relative sizes, just change the root (HTML) element's */
/* font-size. Everything else will adjust accordingly. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment