kenhelm
kenhelm

Reputation: 53

Font percentage ratio

Found this piece of code in a stylesheet:

.dropcap
{
    float:left;
    font:normal 290%/85%;   
    line-height:90%;
    padding-right:0.02em;
    margin-bottom:-0.1em;
} 

Could someone tell me what the percentages (290% and 85%) stand for? I thought 85% was the line height, but I'm obviously wrong.

Upvotes: 2

Views: 83

Answers (3)

Ming
Ming

Reputation: 4588

The 290% should be the font-size, and you're right, the 85% should be line-height, however, that font shorthand declaration is incomplete: it should do nothing. You need to set a font-family in the font shorthand for it to be a valid property value.

http://jsfiddle.net/5Yh3g/

font:normal 290%/85% 'Times New Roman', Times, serif;

EDIT: no, even if it is pre-processed code, it's still an invalid property value.

Upvotes: 3

sachleen
sachleen

Reputation: 31131

You're not wrong, but the statement isn't complete, you have to specify the font-family too.

The line after that line sets the line-height to 90%, though.

https://developer.mozilla.org/en-US/docs/Web/CSS/font#Syntax

/* Set the font size to 12px and the line height to 14px. Set the font family to sans-serif */
p { font: 12px/14px sans-serif }

Upvotes: 0

Brad
Brad

Reputation: 163262

This isn't pure CSS. You're probably using LESS or similar, which can do math.

See also: How to calculate percentages in LESS CSS?

Upvotes: 0

Related Questions