Quick Tip 3 – EM Font Sizes

Font sizes can be tricky, especially when your working with ems. For all of you who are unsure what ems actually are and why you should use them instead of pixels continue to read below.

Ideally everyone would work with pixels however unfortunately some browsers (ie: Internet Explorer) will not re-size text based in pixels as it is a fixed measurement whereas ems is not and almost percentage based.

Trying to work out what 12px is equal to in ems can be a hassle. A quick fix I use on a regular basis helps convert ems to an equal size of pixels when coding and makes life so much easier. So here it is –
Quick Tip Gary

body { font-size: 62.5%; }

With this snippet applied to your body tag it will force ems and pixels to near equals. Example :

  • 1em is equal to 10px
  • 1.1em is equal to 11px
  • 1.2em is equal to 12px
  • 1.3em is equal to 13px
  • 1.4em is equal to 14px
  • so on…

I hope you find this useful as I know it saves me a lot of time.

Related posts:

  1. Cufón Font Replacement
  2. Quick Tip 15 – WP More Tag
  3. Quick Tip 7 – CSS !Important
  4. Quick Tip 13 – WP Promotion
  5. Quick Tip 19 – WP Permalinks

Tags: , , ,

Leave a Reply

Contact Us Today...

For more information regarding any of our services or to arrange a free consultation simply send us a message or call 02920 290 080 for Cardiff and 01179 000 482 for Bristol.

Firefox 4 Beta

Mozilla have released the first beta version of Firefox 4. The latest version of this browser will include better support for many of the new web technologies, a new add on manager, crash protection from third party plugins and accelerated hardware support. One of the most obvious changes is that the tabs have now been moved [...]
» more

Cardiff: 02920 290 080 Bristol: 01179 000 482