Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

How the user agent determine what size (in pixels) font-size:small is?

and font-size:large, etc... I am asking beause I was trying to track down the default font-size for the browser which I know to be 16px (but still wanted to see it in the user agent stylesheet), but in the process found the font-size set to "medium". Then my question was: where is does it say font-size:medium is equal to 16px? These keywords are "absolute" values, so I dont they have exact pixel equivalents somewhere?

2 Answers

Let's check the CSS3 spec to find out shall we:

Imgur

from: http://dev.w3.org/csswg/css-fonts/#font-size-prop

These seem to me to be all relative sizes and that somewhere down the line, they all have to be based on a size we can all agree on (eg- 1 inch). Where do we find this fixed size we all agree on? In the spec, if I understand it correctly, it says the actual size for each of the keywords is computed and kept by the user agent. How does the user agent compute these values?

You can set your standard font size in your font size in your browser preferences. For most browsers that default is usually 16px, so that's probably the absolute size you are thinking of.