Font-Weight CSS Transition in Chrome Font-Weight CSS Transition in Chrome google-chrome google-chrome

Font-Weight CSS Transition in Chrome


The problem is that font weights, when represented numerically, must be a multiple of 100. To animate between 400 and 600, the font would change from 400 to 500 to 600 (3 'frames', if you like) and wouldn't look very smooth. An animation wouldn't increment the weight by 1 each time (400, 401, 402...) it would increment the weight by 100 (400, 500, 600). If your animation lasted 2 seconds, after 1 second the weight would suddenly become 500, and after 2 seconds the weight would suddenly become 600; there are no in-between variations.

A further problem with what you're attempting here is that the font you're using (or JSFiddle's default, at least) doesn't have anything different for font-weight:500, meaning it defaults to 400:

<p style="font-weight:400;">a - 400, normal</p><p style="font-weight:500;">a - 500 (no support, defaults to 400)</p><p style="font-weight:600;">a - 600 (bold)</p><p style="font-weight:650;">a - 650 (not valid, defaults to 400)</p>

http://jsfiddle.net/r4gDh/6/

Numeric font weights for fonts that provide more than just normal and bold. If the exact weight given is unavailable, then 600-900 use the closest available darker weight (or, if there is none, the closest available lighter weight), and 100-500 use the closest available lighter weight (or, if there is none, the closest available darker weight). This means that for fonts that provide only normal and bold, 100-500 are normal, and 600-900 are bold.

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

This basically means that you can't smoothly animate font-weight. Even if you had support for all weights between 100 and 900 the change wouldn't be pleasant and there would be a dramatic change between 500 and 600 (where lighter weight meets darker weight).


Font-weight animation is currently not supported in Chrome and IE-10 based on numerous tests. This may change in the future.


I came here to find out the answer myself for how to transition font weight, and was disappointed when I read the approved answer above saying that it can't be done (or at least not very well).

With font-weight animation unavailable, I decided to try another effect, which actually gives you a font-weight effect... which I didn't even think would work for this type of transition.

Here is how to make the weight grow:

.weightGrow:hover {    text-shadow:    -1px -1px 0 #2DD785,    1px -1px 0 #2DD785,    -1px 1px 0 #2DD785,    1px 1px 0 #2DD785;    -webkit-transition: all .5s;    -moz-transition: all .5s;    -o-transition: all .5s;    transition: all .5s;}

Perfectly smooth and exactly what I was looking for when I first arrived on this page. Hope it helps someone.