conversion of px to em, % and pt
JSFIDDLE: http://jsfiddle.net/jnelsonin/ctfy158o/
This simple formula will help you to convert a px value in CSS to corresponding em, % and pt.
1 2 3 4 5 6 |
pt = (px * 3 ) / 4; em = pt / 12; % = (pt / 12 ) * 100; ie; % = em * 100; |
consider we have a pixel value of 8. Based on the above formula,
pt = (8 * 3) / 4 = 6pt
em = 8 / 12 = 0.5em
% = 0.5 * 100 = 50%
Leave a Reply