/ Published in: Other
*This snippet was originally inspired by [sotetbarna](http://e-texteditor.com/forum/viewtopic.php?p=11786#11786)*
A snippet pipe that will calculate ems based on a given pixel value and base unit.
E.g. If you want a 10px font-size expressed in ems, you would need to perform the following calculation (note 16px is the default base font size in all browsers):
10px / 16px = 0.625em
This snippet allows you to specify the desired pixel size and the base font size and will return the calculated em value.
A snippet pipe that will calculate ems based on a given pixel value and base unit.
E.g. If you want a 10px font-size expressed in ems, you would need to perform the following calculation (note 16px is the default base font size in all browsers):
10px / 16px = 0.625em
This snippet allows you to specify the desired pixel size and the base font size and will return the calculated em value.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
${0:calculate ${1:10}px in ems with a ${2:16}px base| ruby -e "print (ENV['TM_TABSTOP_1'].to_f/ENV['TM_TABSTOP_2'].to_f).to_s + 'em'"}