问题
Possible Duplicate:
CSS Font Size Specifics
I have been wondering what exactly is the font size when it comes to web design.
I mean if I set the font size to 25px, will my text have a height of 25px ?
Because I tried that with photoshop and if I set the font size to 30px, a regular capital letter (ex: "B") will be 24px tall, a regular letter (ex: "a") will be 19px tall and a "j" will be 27px tall.
So what exactly means the font size ?
EDIT: My question may not be clear so, how can you compute the height of a letter based on the font-size ?
回答1:
It represents the size taking as reference the top of the highest letter like a 'I' and the bottom of a descender character like a 'p'
You can find more information on this page
Regards.
回答2:
If you want to calculate the height of a certain text maybe this helps:
http://daipratt.co.uk/calculate-text-width-and-height-with-javascript/
回答3:
If you set font size in em, it will shows same size in all browsers and also in zoom function.
Serif Serif fonts have small lines at the ends on some characters (Times New Roman) Sans-serif "Sans" means without - these fonts do not have the lines at the ends of characters (Arial, Verdana) Monospace All monospace characters have the same width (Courier New, Lucida Console)
来源:https://stackoverflow.com/questions/12373460/what-exactly-is-the-font-size