How to size text using ems - CSS


/ Published in: CSS
Save to your folder(s)

BODY {font-size:62.5%}
This takes 16px down to 10px (16 x 0.625 = 10), which apart from being less huge is a nice round number. From now on it’s easy to think in pixels but still set sizes in terms of ems: 1em is 10px, 0.8em is 8px, 1.6em is 16px, etc. If you are laying out your document using CSS (which you are, right?) then you have probably used a few divs to group together elements. Apply text-size to these divs and your job is almost done. Consider a two column layout with header and footer:

URL: http://clagnut.com/blog/348/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.