Using percent for font size?

前端 未结 5 1565
庸人自扰
庸人自扰 2020-12-13 23:49

I\'ve read a fair bit about resizing fonts recently, most of it deriding using px as an unforgivable crime (ok, maybe not that bad, you get the idea) because it doesn\'t res

5条回答
  •  忘掉有多难
    2020-12-14 00:42

    Maybe will this make more sense of making a font-resize script. I had made a script that did exactly what you desire, but I cant find it any more.

    Pseudo-code:

    var fontSize = 15; // (em) input
    var fontResize = -1;// (em)input
    fontSize = fontSize+fontResize; //current div
    
    for(every inherent parent classname == 'classname-em')
    document.classnameParentSize[numberofclass] = classnameChildSize[numberOfClass]/100*90;
    

    So explained in words. The script needs to resize some fonts, when that is done it will also look for some parent divs to resize those fonts too, except they will be resized 10% less than its inherent. With some puzzling you will have the right conversion. Also try to avoid paddings and border widths.

提交回复
热议问题