Algorithm to replace this duplicated code
So, a linear mapping from 50-200 onto 40-20 is (40-20)/(200-50) = 0.1333 font size points per length. So we can can compute this as

$('.fc-cards').css('font-size', 20 + 0.1333 * (200 - maxLen));


for a sliding linear falloff in font size. If you want to clamp the sizes to change in exactly the same way, you could index them into an array of sizes, computed by the modulus of the length, i.e. something like...

 $('.fc-cards').css('font-size', [40, 25, 22, 20][Math.floor(maxLen / 50)]);


But you'll need suitable checks on the length to ensure you remain in bounds.

These solutions are debatably more elegant though. They take less code, but they're not as easy to read as definitely solving the same problem your original if tests did. I'd probably prefer a loop over a dictionary of range/size possibilities as the best solution:

sizes = [50, 100, 150, 200];
fonts = [40, 25, 22, 20];

for (var i = 0; i &lt; sizes.length; i++)
{
  if (maxLen &lt; sizes[i])
  {
    $('.fc-cards').css('font-size', fonts[i]);
    break;
  }
}


Edit: Changed based on comment that for/in doesn't ensure enumeration order.

I wouldn't rage against the original solution in a code review, either. Elegance is found in the clearest expression of the goal, in tension with the solution efficiency and maintainability (where, in my view, clear expression wins 99/100 times). Efficiency is not a worry here, and adding/removing sizes from the range in the original code is trivial. Hence, pick whatever your team finds easiest to read a solving the "Change the font size based on length in these windows" problem is.