Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 16px/28px mean in a css font rule?

Tags:

css

font-size

I keep on seeing font styles like font: 16px/28px 'Open Sans', 'Helvetica', sans-serif; and I just can't find out what the 16px/28px could mean. Why are there two different font sizes defined?

like image 354
Chris Avatar asked Dec 20 '22 07:12

Chris


2 Answers

It sets both the font size and the line height.

See MDN documentation's example :

/*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 }

like image 150
Denys Séguret Avatar answered Jan 12 '23 22:01

Denys Séguret


16px/28px = Font-size and line height respectively

http://www.w3.org/TR/CSS2/fonts.html#font-shorthand

like image 31
Adrift Avatar answered Jan 12 '23 22:01

Adrift