Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it standard compliant to write font-size: 62.5%/1.2em in CSS?

Tags:

css

I noticed that some stylesheets have something like this:

body { font-size: 62.5%/1.2em; }

I got a warning "unexpected token /" when I wrote this in NetBeans. And if I changed the EM value, say,

body { font-size: 62.5%/1em; }

the computed font-size remained 16px.

My question is, Is it standard compliant to write something like that? And how to computed the actual font-size?

like image 217
powerboy Avatar asked Feb 28 '23 04:02

powerboy


1 Answers

In CSS2, the font-size property does not allow a value of the form x/y.

What you're using is the font short hand property, which allows x/y as a short-hand of font-size: x; line-height: y;. So either use

body { font: 62.5%/1.2em sans-serif; }
/*                       ^^^^^^^^^^ the font-family is needed. */

or

body {
  font-size: 62.5%;
  line-height: 1.2em;
}
like image 68
kennytm Avatar answered Mar 07 '23 01:03

kennytm