Em values in JavaScript

Try changing the font size in the boxes below to see getEmPixels() retrieve the corresponding pixel values.

html {
   font-size: 100%; /* tbd */

   body {
      font-size: 1.25em; /* tbd */

      header {
         font-size: 1rem; /* tbd */
      }

      main {
         font-size: 0.75em; /* tbd */

         section {
            font-size: 2em; /* tbd */

            ul {
               font-size: 0.75rem; /* tbd */
            }
         }
      }

      footer {
         font-size: 0.75em; /* tbd */
      }
   }
}

Say goodbye to hard-coded values in your JavaScript and instead use getEmPixels() to get the actual values.

Brought to you by Tyson Matanich