Krishna Experiences - Tips & Tricks for better management

CSS Developer, Web Programmer

Are you still confuse about the calculation of px to em. Now no worries you can use a simple formula to convert your px size to your exact em calculation.

Formula : 1 ÷ parent font-size × required pixel value = em value

1px = 0.0625em
16px which is Default Browser Font Size which work for all browsers

Now what you have to do all is put

html { font-size: 62.5%;}

in your css file; which will set 1em = 10px.

We do this to make a calculation easy and workable because it is hard to calculate with 16px.

Example
if you have 980px to convert in em is: 980/10 = 98.0 em
divide each pixel value by 10 to convert in em.

Thanks

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Archives

  • May 2008
  • Categories

  • Links



    Meta

    Sweet Home Theme. Powered by WordPressDesign by Print Out, sponsored by - Partnership, supported by - Business plan and Poker online.