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 5 – Compact CSS
  4. Quick Tip 6 – CSS Shorthand
  5. Quick Tip 9 – CSS min height

Tags: , , ,

Leave a Reply

Gary Morgan

Gary Morgan
Sales Director

Martyn Palmer

Martyn Palmer
Lead Designer

Oliver Blake

Oliver Blake
Web Designer

Tom Bradshaw

Adam Church
Web/Print Designer

Website Design

Website Design

For the complete standard compliant website.

Online Shops

Online Shops

Sell Products Online and manage your own stock.

Seo Marketing

SEO Marketing

Rank with search engine optimisation.

Print Design

Print Design

Logo design, stationary design & folder design.