Font-size <12px doesn't have effect in Google Chrome

后端 未结 15 953
萌比男神i
萌比男神i 2020-12-02 14:21

Elements with css font-size <12px doesn\'t have effect in Google Chrome - remains font-size 12px.

What should I do?

My Google Chrome browser uses default

相关标签:
15条回答
  • 2020-12-02 14:59

    disable the auto adjustment by following style.

    * {
        -webkit-text-size-adjust: none;
    }
    
    0 讨论(0)
  • 2020-12-02 14:59

    It works for me in Chrome 4.0.249.78 (36714) , could you be viewing a cached copy?....Try emptying your page cache (I've found chrome very fond of its cache)

    0 讨论(0)
  • 2020-12-02 15:02

    Chrome has a minimum font size setting. Mine was set to 11px (by default) so I had to change it to view smaller font sizes.

    To change the minimum font size in Chrome go to: settings > advanced settings > web content > font size > customise fonts > scroll down to the bottom and you will see the 'minimum font size' slider.

    0 讨论(0)
  • 2020-12-02 15:02

    Chrome and Firefox now allow a minimum font size setting of zero. Chrome 73 had downstream problems with this, and since then Chrome changed their policy and user interface for this setting. I don't know the history on Firefox, and I don't know the state of this setting on Safari or other browsers.

    0 讨论(0)
  • 2020-12-02 15:03
    <html>
    
    <head>
    <style>
        #text {
            transform-origin: top left;
            background: #aed5ff;
        }
    </style>
    <script>
      window.addEventListener('load', function() {
        var node = document.getElementById('text');
        var fontSize = node.style.fontSize.replace(/[\D]+$/, '');
        if (+fontSize <= 12) {
          node.style.fontSize = '12px';
          node.style.transform = `scale(${fontSize / 12})`
        }
      });
    </script>
    </head>
    
    <body>
    <p id='text' style='font-size:10px'>test 10px</p>
    <p style='font-size:12px'>test 12px</p>
    </body>
    </html>
    
    
    
    0 讨论(0)
  • 2020-12-02 15:04

    you can use

    body {
    font-size:125%;
    }

    to set 0.5em=10px.

    0 讨论(0)
提交回复
热议问题